-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dump input when decoding of filename is failing (#942)
- Loading branch information
1 parent
c137424
commit 5d417e0
Showing
8 changed files
with
23,754 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
import logging | ||
import os | ||
import sys | ||
from typing import Any, NoReturn, Optional, Sequence, Tuple | ||
from typing import Any, List, NoReturn, Optional, Sequence, Tuple | ||
from unittest import TestCase, mock | ||
from unittest.mock import ANY, PropertyMock, call | ||
|
||
|
@@ -2085,3 +2085,83 @@ def test_download_raw_photos_policy_as_is(self) -> None: | |
self.assertIn("INFO All photos have been downloaded", self._caplog.text) | ||
|
||
assert result.exit_code == 0 | ||
|
||
def test_download_bad_filename_base64_encoding(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
|
||
files_to_create = [ | ||
("2018/07/30", "IMG_7408.JPG", 1151066), | ||
("2018/07/30", "IMG_7407.JPG", 656257), | ||
] | ||
|
||
files_to_download: List[Tuple[str, str]] = [ | ||
# <>:"/\|?* -- windows | ||
# / & \0x00 -- linux | ||
# aS9uIHY6YQBsKmk/ZFxwPGE+dCJofC5KUE | ||
# ("2018/07/31", "i_n v_a_l_i_d_p_a_t_h_.JPG") | ||
] | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.vcr_path, | ||
base_dir, | ||
"listing_photos_bad_filename_base64_encoding.yml", | ||
files_to_create, | ||
files_to_download, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"5", | ||
"--skip-videos", | ||
"--skip-live-photos", | ||
"--no-progress-bar", | ||
"--threads-num", | ||
"1", | ||
], | ||
) | ||
|
||
self.assertIsInstance(result.exception, ValueError) | ||
# self.assertEqual(result.exception, ValueError("Invalid Input: 'aS9uIHY6YQBsKmk/ZFxwPGE+dCJofC5KUE'")) | ||
|
||
def test_download_bad_filename_utf8_encoding(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
|
||
files_to_create = [ | ||
("2018/07/30", "IMG_7408.JPG", 1151066), | ||
("2018/07/30", "IMG_7407.JPG", 656257), | ||
] | ||
|
||
files_to_download: List[Tuple[str, str]] = [ | ||
# <>:"/\|?* -- windows | ||
# / & \0x00 -- linux | ||
# aS9uIHY6YQBsKmk/ZFxwPGE+dCJofC5KUE -> abcdefgh | ||
# ("2018/07/31", "i_n v_a_l_i_d_p_a_t_h_.JPG") | ||
] | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.vcr_path, | ||
base_dir, | ||
"listing_photos_bad_filename_utf8_encoding.yml", | ||
files_to_create, | ||
files_to_download, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"5", | ||
"--skip-videos", | ||
"--skip-live-photos", | ||
"--no-progress-bar", | ||
"--threads-num", | ||
"1", | ||
], | ||
) | ||
|
||
self.assertIsInstance(result.exception, ValueError) | ||
# self.assertEqual(result.exception, ValueError("Invalid Input: b'i\\xb7\\x1dy\\xf8!'")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
import logging | ||
import os | ||
import sys | ||
from typing import Any, NoReturn, Optional, Sequence, Tuple | ||
from typing import Any, List, NoReturn, Optional, Sequence, Tuple | ||
from unittest import TestCase, mock | ||
from unittest.mock import ANY, PropertyMock, call | ||
|
||
|
@@ -2073,3 +2073,83 @@ def test_download_raw_photos_policy_as_is_name_id7(self) -> None: | |
self.assertIn("INFO All photos have been downloaded", self._caplog.text) | ||
|
||
assert result.exit_code == 0 | ||
|
||
def test_download_bad_filename_base64_encoding_name_id7(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
|
||
files_to_create = [ | ||
("2018/07/30", "IMG_7408_QVI4T2l.JPG", 1151066), | ||
("2018/07/30", "IMG_7407_QVovd0F.JPG", 656257), | ||
] | ||
|
||
files_to_download: List[Tuple[str, str]] = [ | ||
# <>:"/\|?* -- windows | ||
# / & \0x00 -- linux | ||
# aS9uIHY6YQBsKmk/ZFxwPGE+dCJofC5KUE | ||
# ("2018/07/31", "i_n v_a_l_i_d_p_a_t_h_.JPG") | ||
] | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.vcr_path, | ||
base_dir, | ||
"listing_photos_bad_filename_base64_encoding.yml", | ||
files_to_create, | ||
files_to_download, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"5", | ||
"--skip-videos", | ||
"--skip-live-photos", | ||
"--no-progress-bar", | ||
"--file-match-policy", | ||
"name-id7", | ||
], | ||
) | ||
|
||
self.assertIsInstance(result.exception, ValueError) | ||
# ValueError("Invalid Input: 'aS9uIHY6YQBsKmk/ZFxwPGE+dCJofC5KUE'") | ||
|
||
def test_download_bad_filename_utf8_encoding_name_id7(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
|
||
files_to_create = [ | ||
("2018/07/30", "IMG_7408_QVI4T2l.JPG", 1151066), | ||
("2018/07/30", "IMG_7407_QVovd0F.JPG", 656257), | ||
] | ||
|
||
files_to_download: List[Tuple[str, str]] = [ | ||
# <>:"/\|?* -- windows | ||
# / & \0x00 -- linux | ||
# aS9uIHY6YQBsKmk/ZFxwPGE+dCJofC5KUE -> abcdefgh | ||
# ("2018/07/31", "i_n v_a_l_i_d_p_a_t_h_.JPG") | ||
] | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.vcr_path, | ||
base_dir, | ||
"listing_photos_bad_filename_utf8_encoding.yml", | ||
files_to_create, | ||
files_to_download, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"5", | ||
"--skip-videos", | ||
"--skip-live-photos", | ||
"--no-progress-bar", | ||
"--file-match-policy", | ||
"name-id7", | ||
], | ||
) | ||
|
||
self.assertIsInstance(result.exception, ValueError) | ||
# self.assertEqual(result.exception, ValueError("Invalid Input: b'i\\xb7\\x1dy\\xf8!'")) |
Oops, something went wrong.