From 223d2354aca8edc805782693069c7bc8d0149db7 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 17 Apr 2003 16:43:07 +0000 Subject: Urls are unlikely to end with punctuation or closing braces, so strip any 2003-04-16 Jeffrey Stedfast * 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
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 --- camel/ChangeLog | 15 +++++++++++++++ camel/camel-mime-filter-tohtml.c | 11 +++++++---- camel/camel-url-scanner.c | 7 +++++++ 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 + + * 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
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 * 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, ""); } - if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_NL) { - outptr = check_size (filter, outptr, &outend, 5); - outptr = g_stpcpy (outptr, "
"); + if (inptr < inend) { + if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_NL) { + outptr = check_size (filter, outptr, &outend, 5); + outptr = g_stpcpy (outptr, "
"); + } + + *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: <http://www.ce.udel.edu/teaching_award.html> - <http://www.ce.udel.edu/nomination_form.html> + <http://www.ce.udel.edu/nomination_form.html> \ No newline at end of file -- cgit v1.2.3