Spaces:
Runtime error
Runtime error
File size: 462 Bytes
806b771 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# PATH: bot/temp/files.py
import os
import uuid
from bot.core.settings import TMP_DIR
def make_temp_file_path(original_name: str) -> str:
safe = (original_name or "file.bin").replace("/", "_").replace("\\", "_")
uid = uuid.uuid4().hex[:10]
return os.path.join(TMP_DIR, "ytloader", f"{uid}_{safe}")
def cleanup_file(path: str) -> None:
try:
if path and os.path.exists(path):
os.remove(path)
except Exception:
pass |