revert: 取消秒传

This commit is contained in:
Lan
2025-03-01 11:20:37 +08:00
parent 4a50908455
commit a65cf32214
+14 -14
View File
@@ -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