revert: 取消秒传
This commit is contained in:
+14
-14
@@ -162,20 +162,20 @@ chunk_api = APIRouter(prefix="/chunk", tags=["切片"])
|
|||||||
|
|
||||||
@chunk_api.post("/upload/init/", dependencies=[Depends(share_required_login)])
|
@chunk_api.post("/upload/init/", dependencies=[Depends(share_required_login)])
|
||||||
async def init_chunk_upload(data: InitChunkUploadModel):
|
async def init_chunk_upload(data: InitChunkUploadModel):
|
||||||
# 秒传检查
|
# # 秒传检查
|
||||||
existing = await FileCodes.filter(file_hash=data.file_hash).first()
|
# existing = await FileCodes.filter(file_hash=data.file_hash).first()
|
||||||
if existing:
|
# if existing:
|
||||||
if await existing.is_expired():
|
# if await existing.is_expired():
|
||||||
file_storage: FileStorageInterface = storages[settings.file_storage](
|
# file_storage: FileStorageInterface = storages[settings.file_storage](
|
||||||
)
|
# )
|
||||||
await file_storage.delete_file(existing)
|
# await file_storage.delete_file(existing)
|
||||||
await existing.delete()
|
# await existing.delete()
|
||||||
else:
|
# else:
|
||||||
return APIResponse(detail={
|
# return APIResponse(detail={
|
||||||
"code": existing.code,
|
# "code": existing.code,
|
||||||
"existed": True,
|
# "existed": True,
|
||||||
"name": f'{existing.prefix}{existing.suffix}'
|
# "name": f'{existing.prefix}{existing.suffix}'
|
||||||
})
|
# })
|
||||||
|
|
||||||
# 创建上传会话
|
# 创建上传会话
|
||||||
upload_id = uuid.uuid4().hex
|
upload_id = uuid.uuid4().hex
|
||||||
|
|||||||
Reference in New Issue
Block a user