MCPcopy Index your code
hub / github.com/vastsa/FileCodeBox / get_file_path_name

Function get_file_path_name

apps/base/utils.py:22–31  ·  view source on GitHub ↗
(file: UploadFile)

Source from the content-addressed store, hash-verified

20
21
22async 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
34async def get_chunk_file_path_name(

Callers 2

share_fileFunction · 0.90
share_local_fileMethod · 0.90

Calls 2

get_nowFunction · 0.90
sanitize_filenameFunction · 0.90

Tested by

no test coverage detected