(file: UploadFile)
| 20 | |
| 21 | |
| 22 | async def get_file_path_name(file: UploadFile) -> Tuple[str, str, str, str, str]: |
| 23 | today = await get_now() |
| 24 | storage_path = settings.storage_path.strip("/") |
| 25 | file_uuid = uuid.uuid4().hex |
| 26 | filename = await sanitize_filename(unquote(file.filename or "")) |
| 27 | base_path = f"share/data/{today.strftime('%Y/%m/%d')}/{file_uuid}" |
| 28 | path = f"{storage_path}/{base_path}" if storage_path else base_path |
| 29 | prefix, suffix = os.path.splitext(filename) |
| 30 | save_path = f"{path}/{filename}" |
| 31 | return path, suffix, prefix, filename, save_path |
| 32 | |
| 33 | |
| 34 | async def get_chunk_file_path_name( |
no test coverage detected