Skip to content

Commit bdab5bb

Browse files
committed
feat:code style
1 parent c0984bf commit bdab5bb

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

apps/base/utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ async def get_file_path_name(file: UploadFile) -> Tuple[str, str, str, str, str]
2222
filename = await sanitize_filename(unquote(file.filename))
2323
# 使用 UUID 作为子目录名
2424
base_path = f"share/data/{today.strftime('%Y/%m/%d')}/{file_uuid}"
25-
2625
# 如果设置了存储路径,将其添加到基础路径中
2726
path = f"{storage_path}/{base_path}" if storage_path else base_path
28-
2927
prefix, suffix = os.path.splitext(filename)
3028
# 保持原始文件名
3129
save_path = f"{path}/{filename}"
@@ -43,9 +41,7 @@ async def get_chunk_file_path_name(file_name: str, upload_id: str) -> Tuple[str,
4341
return path, suffix, prefix, file_name, save_path
4442

4543

46-
async def get_expire_info(
47-
expire_value: int, expire_style: str
48-
) -> Tuple[Optional[datetime.datetime], int, int, str]:
44+
async def get_expire_info(expire_value: int, expire_style: str) -> Tuple[Optional[datetime.datetime], int, int, str]:
4945
"""获取过期信息"""
5046
expired_count, used_count = -1, 0
5147
now = datetime.datetime.now()

apps/base/views.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,12 @@ async def share_file(
6464
ip: str = Depends(ip_limit["upload"]),
6565
):
6666
await validate_file_size(file, settings.uploadSize)
67-
6867
if expire_style not in settings.expireStyle:
6968
raise HTTPException(status_code=400, detail="过期时间类型错误")
70-
71-
expired_at, expired_count, used_count, code = await get_expire_info(
72-
expire_value, expire_style
73-
)
69+
expired_at, expired_count, used_count, code = await get_expire_info(expire_value, expire_style)
7470
path, suffix, prefix, uuid_file_name, save_path = await get_file_path_name(file)
75-
7671
file_storage: FileStorageInterface = storages[settings.file_storage]()
7772
await file_storage.save_file(file, save_path)
78-
7973
await create_file_code(
8074
code=code,
8175
prefix=prefix,

0 commit comments

Comments
 (0)