Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
2a89037b
Commit
2a89037b
authored
Aug 24, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
downcase gpg key's emails
this is necessary for email comparisons
parent
c5e0bd56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
lib/gitlab/gpg.rb
lib/gitlab/gpg.rb
+1
-1
spec/lib/gitlab/gpg_spec.rb
spec/lib/gitlab/gpg_spec.rb
+15
-0
No files found.
lib/gitlab/gpg.rb
View file @
2a89037b
...
@@ -39,7 +39,7 @@ module Gitlab
...
@@ -39,7 +39,7 @@ module Gitlab
fingerprints
=
CurrentKeyChain
.
fingerprints_from_key
(
key
)
fingerprints
=
CurrentKeyChain
.
fingerprints_from_key
(
key
)
GPGME
::
Key
.
find
(
:public
,
fingerprints
).
flat_map
do
|
raw_key
|
GPGME
::
Key
.
find
(
:public
,
fingerprints
).
flat_map
do
|
raw_key
|
raw_key
.
uids
.
map
{
|
uid
|
{
name:
uid
.
name
,
email:
uid
.
email
}
}
raw_key
.
uids
.
map
{
|
uid
|
{
name:
uid
.
name
,
email:
uid
.
email
.
downcase
}
}
end
end
end
end
end
end
...
...
spec/lib/gitlab/gpg_spec.rb
View file @
2a89037b
...
@@ -42,6 +42,21 @@ describe Gitlab::Gpg do
...
@@ -42,6 +42,21 @@ describe Gitlab::Gpg do
described_class
.
user_infos_from_key
(
'bogus'
)
described_class
.
user_infos_from_key
(
'bogus'
)
).
to
eq
[]
).
to
eq
[]
end
end
it
'downcases the email'
do
public_key
=
double
(
:key
)
fingerprints
=
double
(
:fingerprints
)
uid
=
double
(
:uid
,
name:
'Nannie Bernhard'
,
email:
'NANNIE.BERNHARD@EXAMPLE.COM'
)
raw_key
=
double
(
:raw_key
,
uids:
[
uid
])
allow
(
Gitlab
::
Gpg
::
CurrentKeyChain
).
to
receive
(
:fingerprints_from_key
).
with
(
public_key
).
and_return
(
fingerprints
)
allow
(
GPGME
::
Key
).
to
receive
(
:find
).
with
(
:public
,
anything
).
and_return
([
raw_key
])
user_infos
=
described_class
.
user_infos_from_key
(
public_key
)
expect
(
user_infos
).
to
eq
([{
name:
'Nannie Bernhard'
,
email:
'nannie.bernhard@example.com'
}])
end
end
end
describe
'.current_home_dir'
do
describe
'.current_home_dir'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment