MinerU / magic_pdf /libs /safe_filename.py
derful's picture
Upload folder using huggingface_hub
240e0a0 verified
raw
history blame contribute delete
236 Bytes
import os
def sanitize_filename(filename, replacement="_"):
if os.name == 'nt':
invalid_chars = '<>:"|?*'
for char in invalid_chars:
filename = filename.replace(char, replacement)
return filename