Browse Source
Merge pull request #4528 from chris03/bugfix/replace-expr
SMTP notify: Use grep -E instead of expr
pull/4532/head
neil
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
notify/smtp.sh
|
@ -169,7 +169,7 @@ _clean_email_header() { |
|
|
# email |
|
|
# email |
|
|
_email_has_display_name() { |
|
|
_email_has_display_name() { |
|
|
_email="$1" |
|
|
_email="$1" |
|
|
expr "$_email" : '^.*[<>"]' >/dev/null |
|
|
|
|
|
|
|
|
echo "$_email" | grep -q -E '^.*[<>"]' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
## |
|
|
## |
|
@ -249,7 +249,7 @@ _mime_encoded_word() { |
|
|
_text="$1" |
|
|
_text="$1" |
|
|
# (regex character ranges like [a-z] can be locale-dependent; enumerate ASCII chars to avoid that) |
|
|
# (regex character ranges like [a-z] can be locale-dependent; enumerate ASCII chars to avoid that) |
|
|
_ascii='] $`"'"[!#%&'()*+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ~^_abcdefghijklmnopqrstuvwxyz{|}~-" |
|
|
_ascii='] $`"'"[!#%&'()*+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ~^_abcdefghijklmnopqrstuvwxyz{|}~-" |
|
|
if expr "$_text" : "^.*[^$_ascii]" >/dev/null; then |
|
|
|
|
|
|
|
|
if echo "$_text" | grep -q -E "^.*[^$_ascii]"; then |
|
|
# At least one non-ASCII char; convert entire thing to encoded word |
|
|
# At least one non-ASCII char; convert entire thing to encoded word |
|
|
printf "%s" "=?UTF-8?B?$(printf "%s" "$_text" | _base64)?=" |
|
|
printf "%s" "=?UTF-8?B?$(printf "%s" "$_text" | _base64)?=" |
|
|
else |
|
|
else |
|
|