rockdaboot / wget2

The successor of GNU Wget. Contributions preferred at https://gitlab.com/gnuwget/wget2. But accepted here as well 😍
GNU Lesser General Public License v3.0
557 stars 76 forks source link

Incorrect filename produced #230

Closed malefient closed 2 years ago

malefient commented 4 years ago

Linux Mint, GNU Wget2 1.99.2 +digest +https +ssl/gnutls +ipv6 +iri +large-file +nls -ntlm -opie +psl -hsts +iconv +idn2 +zlib +lzma +brotlidec +zstd +bzip2 +lzip +http2 -gpgme

There is a web page https://stroyday.ru/remont-kvartiry/steny-i-potolok/kak-sdelat-stenu-iz-gipsokartona.html which contains a link to an image file https://secure.gravatar.com/avatar/?s=40&d=https%3A%2F%2Fstroyday.ru%2Fwp-content%2Fthemes%2FnewSD%2Fres%2Fimg%2Fdef-avatar.png&r=g The latter link is expected to be converted to a local link and image to be downloaded as I specified --page-requisites and --convert-links in the following command. The link is converted to /home/.../secure.gravatar.com/avatar/index.html?s=40&d=https%3A%2F%2Fstroyday.ru%2Fwp-content%2Fthemes%2FnewSD%2Fres%2Fimg%2Fdef-avatar.png&r=g and the file is downloaded.

Having opened the web page in Mozilla Firefox the browser is unable to render the image from local link because it needs it to be

/home/.../index.html%3Fs=40&d=https%253A%252F%252Fstroyday.ru%252Fwp-content%252Fthemes%252FnewSD%252Fres%252Fimg%252Fdef-avatar.png&r=g

but not

/home/.../index.html?s=40&d=https%3A%2F%2Fstroyday.ru%2Fwp-content%2Fthemes%2FnewSD%2Fres%2Fimg%2Fdef-avatar.png&r=g

wget2 \
--output-file=$logs \
--user-agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0" \
--max-redirect=3 \
--timestamping \
--compression="gzip,lzma,bzip2,zstd,lzip" \
--max-threads=75 \
--continue \
--directory-prefix="$bFilesDir" \
--span-hosts \
--timeout=5 \
--tries=1 \
--ignore-length \
--no-check-certificate \
--page-requisites \
--restrict-file-names=nocontrol \
--follow-tags="img/data-500px,img/data-hires,img/data-src,img/data-image-src" \
--convert-links \
"https://stroyday.ru/remont-kvartiry/steny-i-potolok/kak-sdelat-stenu-iz-gipsokartona.html"
rockdaboot commented 2 years ago

Thanks for the report (and sorry for the quite long delay). You are right and this is on top of my wget2 todo list now.

rockdaboot commented 2 years ago

Fixed via commits 72f48aaa1feefe514d7a760d06034cad6b7fa291 and be4e2deaf92960f7a12f8d36e0a97b4745e8f8e9.