diff --git a/src/apps/mail/Content.cpp b/src/apps/mail/Content.cpp index 8361c8a51f..9271f184eb 100644 --- a/src/apps/mail/Content.cpp +++ b/src/apps/mail/Content.cpp @@ -346,10 +346,19 @@ CheckForURL(const char *string, size_t &urlLength, BString *url = NULL) if (type == 0) return 0; - int32 index = 0; - if (type == TYPE_URL) { - index = strcspn(string, " <>\"\r\n"); + int32 index = strcspn(string, " \t<>)\"\\,\r\n"); + // filter out some punctuation marks if they are the last character + char suffix = string[index - 1]; + if (suffix == '.' + || suffix == ',' + || suffix == '?' + || suffix == '!' + || suffix == ':' + || suffix == ';') + index--; + + if (type == TYPE_URL) { char *parenthesis = NULL; // filter out a trailing ')' if there is no left parenthesis before @@ -366,18 +375,6 @@ CheckForURL(const char *string, size_t &urlLength, BString *url = NULL) index--; } } - else - index = strcspn(string, " \t>)\"\\,\r\n"); - - // filter out some punctuation marks if they are the last character - char suffix = string[index - 1]; - if (suffix == '.' - || suffix == ',' - || suffix == '?' - || suffix == '!' - || suffix == ':' - || suffix == ';') - index--; if (url != NULL) { // copy the address to the specified string