File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,8 @@ def structure_dir_path dir_path
201201 end
202202
203203 def download_file file_remote_info
204- file_url = file_remote_info [ :file_url ]
204+ current_encoding = "" . encoding
205+ file_url = file_remote_info [ :file_url ] . encode ( current_encoding )
205206 file_id = file_remote_info [ :file_id ]
206207 file_timestamp = file_remote_info [ :timestamp ]
207208 file_path_elements = file_id . split ( '/' )
Original file line number Diff line number Diff line change @@ -89,5 +89,19 @@ def test_file_list_exclude_filter_with_a_regex
8989 @wayback_machine_downloader . all = true
9090 assert_equal 69 , @wayback_machine_downloader . get_file_list_curated . size
9191 end
92+
93+ # Testing encoding conflicts needs a different base_url
94+ def test_nonascii_suburls_download
95+ @wayback_machine_downloader = WaybackMachineDownloader . new base_url : 'https://en.wikipedia.org/wiki/%C3%84'
96+ # Once just for the downloading...
97+ @wayback_machine_downloader . download_files
98+ end
99+
100+ def test_nonascii_suburls_already_present
101+ @wayback_machine_downloader = WaybackMachineDownloader . new base_url : 'https://en.wikipedia.org/wiki/%C3%84'
102+ # ... twice to test the "is already present" case
103+ @wayback_machine_downloader . download_files
104+ @wayback_machine_downloader . download_files
105+ end
92106
93107end
You can’t perform that action at this time.
0 commit comments