feat: move clean paths util from daq
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import re
|
||||
|
||||
|
||||
def clean_filename(filename: str) -> str:
|
||||
cleaned = re.sub(r"[^A-Za-z0-9._-]", "_", filename.strip())
|
||||
cleaned = cleaned.strip("._-")
|
||||
if not cleaned:
|
||||
raise ValueError("Filename is empty after sanitization.")
|
||||
return cleaned
|
||||
Reference in New Issue
Block a user