On March 29th, Alejandro Supu reported an issue on the list (Bug on latest 
wget (1.3.14).

I could reproduce his problem with the trunk version.
In url.c / url_file_name() an empty query is not used for the filename 
generation.

I wrote a patch which I forgot to put on the list. Here it comes ;-)

Tim
=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-03-25 15:49:55 +0000
+++ src/ChangeLog	2012-03-30 09:18:54 +0000
@@ -1,3 +1,7 @@
+2012-03-30  Tim Ruehsen  <[email protected]>
+
+	* url.c: use empty query in local filenames
+
 2012-03-25  Giuseppe Scrivano  <[email protected]>

 	* utils.c: Include <sys/ioctl.h>.

=== modified file 'src/url.c'
--- src/url.c	2011-01-01 12:19:37 +0000
+++ src/url.c	2012-03-30 09:14:56 +0000
@@ -1502,7 +1502,7 @@
 {
   struct growable fnres;        /* stands for "file name result" */

-  const char *u_file, *u_query;
+  const char *u_file;
   char *fname, *unique;
   char *index_filename = "index.html"; /* The default index file is index.html */

@@ -1561,12 +1561,11 @@
       u_file = *u->file ? u->file : index_filename;
       append_uri_pathel (u_file, u_file + strlen (u_file), false, &fnres);

-      /* Append "?query" to the file name. */
-      u_query = u->query && *u->query ? u->query : NULL;
-      if (u_query)
+      /* Append "?query" to the file name, even if empty */
+      if (u->query)
 	{
 	  append_char (FN_QUERY_SEP, &fnres);
-	  append_uri_pathel (u_query, u_query + strlen (u_query),
+	  append_uri_pathel (u->query, u->query + strlen (u->query),
 			     true, &fnres);
 	}
     }

Reply via email to