We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1556e35 commit fd61c3eCopy full SHA for fd61c3e
1 file changed
scanpipe/pipes/__init__.py
@@ -45,29 +45,19 @@
45
46
47
def normalize_extension(name, extension, max_length=100):
48
- """
49
- Return a safe file extension or None.
50
-
51
- Ensures the extension is derived from the file name and avoids
52
- storing invalid or oversized values.
53
54
if not name:
55
- return None
+ return ""
56
57
- # Recompute extension from name (do not trust incoming value)
58
suffix = Path(name).suffix
59
60
if not suffix:
61
62
63
- # Reject suspicious or non-standard extensions
64
if not suffix.startswith("."):
65
66
67
- # Typical extensions are short (.py, .json, etc.)
68
- # Reject overly long ones instead of truncating garbage
69
if len(suffix) > 20:
70
71
72
return suffix
73
0 commit comments