Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
diceware-debian
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drebs
diceware-debian
Commits
ba852cbc
Commit
ba852cbc
authored
9 years ago
by
ulif
Browse files
Options
Downloads
Patches
Plain Diff
Fix refine_wordlist_entry: strip dash-esceptd entries.
Make sure signed entries are stripped also if dash-escaped.
parent
e2d9a988
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
diceware/wordlist.py
+1
-1
1 addition, 1 deletion
diceware/wordlist.py
tests/test_wordlist.py
+8
-0
8 additions, 0 deletions
tests/test_wordlist.py
with
9 additions
and
1 deletion
diceware/wordlist.py
+
1
−
1
View file @
ba852cbc
...
...
@@ -64,9 +64,9 @@ def refine_wordlist_entry(entry, signed=False):
Set `signed` to `True` if the entry is part of a cryptographically
signed wordlist.
"""
entry
=
entry
.
strip
()
if
signed
and
entry
.
startswith
(
'
-
'
):
entry
=
entry
[
2
:]
entry
=
entry
.
strip
()
match
=
RE_NUMBERED_WORDLIST_ENTRY
.
match
(
entry
)
if
match
:
entry
=
match
.
groups
()[
0
]
...
...
This diff is collapsed.
Click to expand it.
tests/test_wordlist.py
+
8
−
0
View file @
ba852cbc
...
...
@@ -181,3 +181,11 @@ class TestWordlistModule(object):
# we handle dash-escaped lines correctly when in signed mode
assert
refine_wordlist_entry
(
"
- foo
"
)
==
"
- foo
"
assert
refine_wordlist_entry
(
"
- foo
"
,
signed
=
True
)
==
"
foo
"
def
test_refine_wordlist_strips_also_dash_quoted
(
self
):
# also dash-escaped lines in signed wordlistgs are stripped.
assert
refine_wordlist_entry
(
"
-
\t
foo
\n
"
,
signed
=
True
)
==
"
foo
"
def
test_refine_wordlist_strips_also_numbered
(
self
):
# also numbered entries are stripped
assert
refine_wordlist_entry
(
"
11111
\t
foo
\n
"
)
==
"
foo
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment