Merge pull request #14 from elidickinson/fix-bracket-urls

Fix bug with archive urls containing square brackets
This commit is contained in:
Felipe 2025-06-03 23:12:07 -03:00 committed by GitHub
commit 2bf74b4173
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -721,6 +721,9 @@ class WaybackMachineDownloader
"https://web.archive.org/web/#{file_timestamp}id_/#{file_url}" "https://web.archive.org/web/#{file_timestamp}id_/#{file_url}"
end end
# Escape square brackets because they are not valid in URI()
wayback_url = wayback_url.gsub('[', '%5B').gsub(']', '%5D')
request = Net::HTTP::Get.new(URI(wayback_url)) request = Net::HTTP::Get.new(URI(wayback_url))
request["Connection"] = "keep-alive" request["Connection"] = "keep-alive"
request["User-Agent"] = "WaybackMachineDownloader/#{VERSION}" request["User-Agent"] = "WaybackMachineDownloader/#{VERSION}"