Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"File not found" errors with Ruby 3.2.x #3

Open
morgant opened this issue May 19, 2024 · 0 comments
Open

"File not found" errors with Ruby 3.2.x #3

morgant opened this issue May 19, 2024 · 0 comments

Comments

@morgant
Copy link

morgant commented May 19, 2024

I'm currently testing wayback_machine_downloader under OpenBSD amd64/7.5-stable and ruby 3.2.4. When attempting to download a single page, for example:

 $ ./bin/wayback_machine_downloader "http://www.folklore.org/ProjectView.py?name=Newton" --to 20120222134837 -l Getting snapshot pages~/Projects/wayback-machine-downloader/lib/wayback_machine_downloader/archive_api.rb:8:in `initialize': No such file or directory @ rb_sysopen - http://web.archive.org/cdx/search/xd?url=http://www.folklore.org/ProjectView.py?name=Newton&fl=timestamp,original&collapse=digest&gzip=false&filter=statuscode:200&to=20120222134837 (Errno::ENOENT)
       from ~/Projects/wayback-machine-downloader/lib/wayback_machine_downloader/archive_api.rb:8:in `open'
       from ~/Projects/wayback-machine-downloader/lib/wayback_machine_downloader/archive_api.rb:8:in `get_raw_list_from_api'
       from ~/Projects/wayback-machine-downloader/lib/wayback_machine_downloader.rb:88:in `get_all_snapshots_to_consider'
       from ~/Projects/wayback-machine-downloader/lib/wayback_machine_downloader.rb:105:in `get_file_list_curated'
       from ~/Projects/wayback-machine-downloader/lib/wayback_machine_downloader.rb:168:in `get_file_list_by_timestamp'
       from ~/Projects/wayback-machine-downloader/lib/wayback_machine_downloader.rb:179:in `list_files'
       from ./bin/wayback_machine_downloader:70:in `<main>'

This is because open-uri used to replace Kernel#open, but that's a security nightmare and so that functionality was deprecated and finally removed sometime in ruby 3.x. So, uses of open() which fetch URLs should be replaced with URI.open().

morgant added a commit to UNNA/wayback-machine-downloader that referenced this issue Jun 3, 2024
…r#download_file as the URI should only be escaped when querying the WaybackMachine API, not when requesting files. Issue cocoflan#3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant