Spaces:
Runtime error
Runtime error
| # 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 |