--- "a/url.c"
+++ "b/url.patched.c"
@@ -1726,6 +1726,9 @@ url_file_name (const struct url *u, char *replaced_filename)
         fname_len_check = concat_strings (u_file, FN_QUERY_SEP_STR, u->query, NULL);
       else
         fname_len_check = strdupdelim (u_file, u_file + strlen (u_file));
+
+      /* convert before concat with local path */
+      fname_len_check = convert_fname (fname_len_check);
     }
   else
     {
@@ -1787,8 +1790,6 @@ url_file_name (const struct url *u, char *replaced_filename)
 
   xfree (temp_fnres.base);
 
-  fname = convert_fname (fname);
-
   /* Check the cases in which the unique extensions are not used:
      1) Clobbering is turned off (-nc).
      2) Retrieval with regetting.
