bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Problem with encoded spaces in CSS @import


From: Giuseppe Scrivano
Subject: Re: [Bug-wget] Problem with encoded spaces in CSS @import
Date: Tue, 14 Sep 2010 12:16:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Manuel Reinhardt <address@hidden> writes:

> When downloading an html document with
>
> wget -E -k -p http://...
>
> I noticed that sometimes some of the Stylesheets are not found when
> opening the local copy. This happens when the html uses a CSS @import
> statement that includes a URL containing spaces encoded as %20. While
> converting to a local URL, wget changes the spaces to &#34;, which does
> not work there.

Thanks for your report!  I am going to push this patch, it disables HTML
quoting in CSS files.


Cheers,
Giuseppe



=== modified file 'src/convert.c'
--- src/convert.c       2010-08-20 01:11:07 +0000
+++ src/convert.c       2010-09-14 09:55:31 +0000
@@ -203,7 +203,7 @@
 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 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 @@
             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 @@
    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 @@
       }
   *to = '\0';
 
-  return html_quote_string (newname);
+  return no_html_quote ? strdup (newname) : html_quote_string (newname);
 }
 
 /* Book-keeping code for dl_file_url_map, dl_url_file_map,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]