]> sjero.net Git - wget/commitdiff
Do not use HTML quoting in CSS files.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Tue, 14 Sep 2010 10:14:34 +0000 (12:14 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Tue, 14 Sep 2010 10:14:34 +0000 (12:14 +0200)
src/ChangeLog
src/convert.c

index e7b34f520d31d456c2e893e1255717ff11ade57a..55b2be8fb5c669994f546a9a80390c9c0cdac6e0 100644 (file)
@@ -1,3 +1,10 @@
+2010-09-14  Giuseppe Scrivano  <gscrivano@gnu.org>
+
+       * convert.c (local_quote_string): Accept new parameter `no_html_quote'.
+       Inhibit HTML quoting when `no_html_quote'.
+       (convert_links): Disable HTML quoting in CSS files.
+       Reported by: Manuel Reinhardt <reinhardt@syslab.com>.
+
 2010-09-12  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * main.c (print_help): Align --trust-server-names help text with
index 3459edada8d1ec3ca081ab9183583a2fa3dcea2a..4efc27beb0b2dce759b1d66c5e06c3ee75aac2ee 100644 (file)
@@ -203,7 +203,7 @@ static const char *replace_plain (const char*, int, FILE*, const char *);
 static const char *replace_attr (const char *, int, FILE *, const char *);
 static const char *replace_attr_refresh_hack (const char *, int, FILE *,
                                               const char *, int);
-static char *local_quote_string (const char *);
+static char *local_quote_string (const char *, bool);
 static char *construct_relative (const char *, const char *);
 
 /* Change the links in one file.  LINKS is a list of links in the
@@ -301,7 +301,8 @@ convert_links (const char *file, struct urlpos *links)
           /* Convert absolute URL to relative. */
           {
             char *newname = construct_relative (file, link->local_name);
-            char *quoted_newname = local_quote_string (newname);
+            char *quoted_newname = local_quote_string (newname,
+                                                       link->link_css_p);
 
             if (link->link_css_p)
               p = replace_plain (p, link->size, fp, quoted_newname);
@@ -325,7 +326,7 @@ convert_links (const char *file, struct urlpos *links)
             char *quoted_newlink = html_quote_string (newlink);
 
             if (link->link_css_p)
-              p = replace_plain (p, link->size, fp, quoted_newlink);
+              p = replace_plain (p, link->size, fp, newlink);
             else if (!link->link_refresh_p)
               p = replace_attr (p, link->size, fp, quoted_newlink);
             else
@@ -612,14 +613,14 @@ find_fragment (const char *beg, int size, const char **bp, const char **ep)
    because those characters have special meanings in URLs.  */
 
 static char *
-local_quote_string (const char *file)
+local_quote_string (const char *file, bool no_html_quote)
 {
   const char *from;
   char *newname, *to;
 
   char *any = strpbrk (file, "?#%;");
   if (!any)
-    return html_quote_string (file);
+    return no_html_quote ? strdup (file) : html_quote_string (file);
 
   /* Allocate space assuming the worst-case scenario, each character
      having to be quoted.  */
@@ -656,7 +657,7 @@ local_quote_string (const char *file)
       }
   *to = '\0';
 
-  return html_quote_string (newname);
+  return no_html_quote ? strdup (newname) : html_quote_string (newname);
 }
 \f
 /* Book-keeping code for dl_file_url_map, dl_url_file_map,