Skip to content

Commit b0c0205

Browse files
committed
fix
1 parent dca4259 commit b0c0205

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

usr/libexec/helper-scripts/strings.bsh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ validate_safe_filename() {
139139
else
140140
## Allow: letters/digits (locale-aware), underscore, dash, dot, space,
141141
## plus, comma, equals, @, parentheses, braces, square brackets
142-
re='^[][:alnum:]_.@+=,(){}\[ -]+$'
142+
re='^[][:alnum:]_.:@+=,(){}\[ -]+$'
143143
if [[ "$value" =~ $re ]]; then
144144
return 0
145145
fi
@@ -282,7 +282,8 @@ tests() {
282282
run_test "safe_filename: rejects slash" validate_safe_filename 1 test_value "dir/file"
283283
run_test "safe_filename: rejects backslash" validate_safe_filename 1 test_value $'dir\\file'
284284
run_test "safe_filename: rejects control char newline" validate_safe_filename 1 test_value $'hello\nworld'
285-
run_test "safe_filename: rejects leading dash" validate_safe_filename 1 test_value "-rf"
285+
run_test "safe_filename: rejects leading dash" validate_safe_filename 1 test_value "-option"
286+
run_test "safe_filename: accepts colon" validate_safe_filename 0 test_value "test:test"
286287
run_test "safe_filename: rejects overlong name" validate_safe_filename 1 test_value "$(printf 'a%.0s' {1..256})"
287288
## TODO: unclear if this is possible without unicode-show
288289
#run_test "safe_filename: rejects unicode" validate_safe_filename 1 test_value $'caf\xC3\xA9'

0 commit comments

Comments
 (0)