Skip to content

Commit 2bf74b4

Browse files
Merge pull request #14 from elidickinson/fix-bracket-urls
Fix bug with archive urls containing square brackets
2 parents 071d208 + 79cbb63 commit 2bf74b4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/wayback_machine_downloader.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,9 @@ def download_with_retry(file_path, file_url, file_timestamp, connection, redirec
721721
"https://web.archive.org/web/#{file_timestamp}id_/#{file_url}"
722722
end
723723

724+
# Escape square brackets because they are not valid in URI()
725+
wayback_url = wayback_url.gsub('[', '%5B').gsub(']', '%5D')
726+
724727
request = Net::HTTP::Get.new(URI(wayback_url))
725728
request["Connection"] = "keep-alive"
726729
request["User-Agent"] = "WaybackMachineDownloader/#{VERSION}"

0 commit comments

Comments
 (0)