diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-04-18 00:43:07 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-04-18 00:43:07 +0800 |
commit | 223d2354aca8edc805782693069c7bc8d0149db7 (patch) | |
tree | be0279935eb03324d9f529d15cc7ee7f0adcf542 /camel | |
parent | 78c1eb5c1af5359f6aef675c5eb5f8918a1d8660 (diff) | |
download | gsoc2013-evolution-223d2354aca8edc805782693069c7bc8d0149db7.tar.gz gsoc2013-evolution-223d2354aca8edc805782693069c7bc8d0149db7.tar.zst gsoc2013-evolution-223d2354aca8edc805782693069c7bc8d0149db7.zip |
Urls are unlikely to end with punctuation or closing braces, so strip any
2003-04-16 Jeffrey Stedfast <fejj@ximian.com>
* camel-url-scanner.c (camel_url_web_end): Urls are unlikely to
end with punctuation or closing braces, so strip any of those off
the end of the url. Fixes bug #41461.
* tests/mime-filter/data/html.1.out: Removed a trailing \n at the
end of the file, this is incorrect (since out input file does not
contain one).
* camel-mime-filter-tohtml.c (html_convert): Only output a <br> if
we found an eoln in the input. Along the same lines, don't write a
'\n' to the output buffer unless we've encountered that eoln in
the input. Fixes bug #41407.
svn path=/trunk/; revision=20882
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 15 | ||||
-rw-r--r-- | camel/camel-mime-filter-tohtml.c | 11 | ||||
-rw-r--r-- | camel/camel-url-scanner.c | 7 | ||||
-rw-r--r-- | camel/tests/mime-filter/data/html.1.out | 2 |
4 files changed, 30 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index aed9ecda3f..9532578654 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,18 @@ +2003-04-16 Jeffrey Stedfast <fejj@ximian.com> + + * camel-url-scanner.c (camel_url_web_end): Urls are unlikely to + end with punctuation or closing braces, so strip any of those off + the end of the url. Fixes bug #41461. + + * tests/mime-filter/data/html.1.out: Removed a trailing \n at the + end of the file, this is incorrect (since out input file does not + contain one). + + * camel-mime-filter-tohtml.c (html_convert): Only output a <br> if + we found an eoln in the input. Along the same lines, don't write a + '\n' to the output buffer unless we've encountered that eoln in + the input. Fixes bug #41407. + 2003-04-17 Not Zed <NotZed@Ximian.com> * camel-multipart-signed.c (parse_content): Dont assume adding 1 diff --git a/camel/camel-mime-filter-tohtml.c b/camel/camel-mime-filter-tohtml.c index ca10d3d438..0ffd1ed26b 100644 --- a/camel/camel-mime-filter-tohtml.c +++ b/camel/camel-mime-filter-tohtml.c @@ -320,12 +320,15 @@ html_convert (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespace, outptr = g_stpcpy (outptr, "</font>"); } - if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_NL) { - outptr = check_size (filter, outptr, &outend, 5); - outptr = g_stpcpy (outptr, "<br>"); + if (inptr < inend) { + if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_NL) { + outptr = check_size (filter, outptr, &outend, 5); + outptr = g_stpcpy (outptr, "<br>"); + } + + *outptr++ = '\n'; } - *outptr++ = '\n'; start = ++inptr; } while (inptr < inend); diff --git a/camel/camel-url-scanner.c b/camel/camel-url-scanner.c index 1151449ffc..8a43b05aee 100644 --- a/camel/camel-url-scanner.c +++ b/camel/camel-url-scanner.c @@ -359,6 +359,13 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_ while (inptr < inend && is_urlsafe (*inptr) && *inptr != close_brace) inptr++; + /* urls are extremely unlikely to end with any + * punctuation, so strip any trailing + * punctuation off. Also strip off any closing + * braces. */ + while (inptr > pos && strchr (",.?!)}]", inptr[-1])) + inptr--; + break; default: break; diff --git a/camel/tests/mime-filter/data/html.1.out b/camel/tests/mime-filter/data/html.1.out index 3f19310dd4..71a977e7ff 100644 --- a/camel/tests/mime-filter/data/html.1.out +++ b/camel/tests/mime-filter/data/html.1.out @@ -7,4 +7,4 @@ Teaching Award. The award criteria and nomination form are attached. They can also be found on the web at: 	<<a href="http://www.ce.udel.edu/teaching_award.html">http://www.ce.udel.edu/teaching_award.html</a>> -	<<a href="http://www.ce.udel.edu/nomination_form.html">http://www.ce.udel.edu/nomination_form.html</a>> +	<<a href="http://www.ce.udel.edu/nomination_form.html">http://www.ce.udel.edu/nomination_form.html</a>>
\ No newline at end of file |