Skip to content

Commit

Permalink
chore: include file extension in max filename len
Browse files Browse the repository at this point in the history
  • Loading branch information
iamogbz committed Nov 13, 2020
1 parent 6b47681 commit 5d2b9ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/syrupy/extensions/single_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _write_snapshot_fossil(self, *, snapshot_fossil: "SnapshotFossil") -> None:

def __clean_filename(self, filename: str) -> str:
filename = str(filename).strip().replace(" ", "_")
max_filename_length = 255 - len(self._file_extension or "")
exclude_chars = '\\/?%*:|"<>,;='
exclude_categ = ("C",)
cleaned_filename = "".join(
Expand All @@ -77,4 +78,4 @@ def __clean_filename(self, filename: str) -> str:
if c not in exclude_chars
and not any(categ in category(c) for categ in exclude_categ)
)
return cleaned_filename[:255] # maximum filename length
return cleaned_filename[:max_filename_length]

0 comments on commit 5d2b9ca

Please sign in to comment.