This commit is contained in:
Jesse Bannon 2023-03-09 23:37:38 -08:00
parent cfdb264e6d
commit 842e15c4f0
2 changed files with 2 additions and 3 deletions

View file

@ -83,13 +83,13 @@ class StringFormatterFilePathValidator(StringFormatterValidator):
def apply_formatter(self, variable_dict: Dict[str, str]) -> str:
"""Turn into a Path, then a string, to get correct directory separators"""
file_path = str(Path(super().apply_formatter(variable_dict)))
file_path = Path(super().apply_formatter(variable_dict))
file_directory, file_name = os.path.split(Path(file_path))
if self._is_file_name_too_long(file_name):
return str(Path(file_directory) / self._truncate_file_name(file_name))
return file_path
return str(file_path)
class OverridesStringFormatterValidatorFilePathValidator(OverridesStringFormatterValidator):

View file

@ -17,7 +17,6 @@ class TestStringFormatterFilePathValidator:
+ [f".en.{ext}" for ext in SUBTITLE_EXTENSIONS],
)
def test_truncates_file_name_successfully(self, ext: str):
ext = ".info.json"
with tempfile.TemporaryDirectory() as temp_dir:
file_name = ("a" * 10000) + ext
file_path = str(Path(temp_dir) / file_name)