fix: remove sha256 duplicate check so re-upload always creates new version in group
This commit is contained in:
@@ -161,25 +161,17 @@ class DocumentServiceImpl(IDocumentService):
|
|||||||
normalized_name=normalizedName,
|
normalized_name=normalizedName,
|
||||||
)
|
)
|
||||||
|
|
||||||
if latestCandidate and latestCandidate["sha256"] == fileSha256:
|
internalDocumentNo = time.time_ns()
|
||||||
duplicateUpload = True
|
if latestCandidate:
|
||||||
document = await Session.get(LeauditDocument, int(latestCandidate["document_id"]))
|
previousVersionId = int(latestCandidate["document_id"])
|
||||||
documentFile = await Session.get(LeauditDocumentFile, int(latestCandidate["file_id"]))
|
rootVersionId = int(latestCandidate["root_version_id"] or latestCandidate["document_id"])
|
||||||
if document is None or documentFile is None:
|
versionGroupKey = str(latestCandidate["version_group_key"])
|
||||||
raise LeauditException(StatusCodeEnum.HTTP_500_INTERNAL_SERVER_ERROR, "重复上传版本定位失败")
|
versionNo = int(latestCandidate["version_no"]) + 1
|
||||||
await Session.commit()
|
previousDocument = await Session.get(LeauditDocument, previousVersionId)
|
||||||
|
if previousDocument is not None:
|
||||||
|
previousDocument.isLatestVersion = False
|
||||||
else:
|
else:
|
||||||
internalDocumentNo = time.time_ns()
|
versionGroupKey = uuid.uuid4().hex
|
||||||
if latestCandidate:
|
|
||||||
previousVersionId = int(latestCandidate["document_id"])
|
|
||||||
rootVersionId = int(latestCandidate["root_version_id"] or latestCandidate["document_id"])
|
|
||||||
versionGroupKey = str(latestCandidate["version_group_key"])
|
|
||||||
versionNo = int(latestCandidate["version_no"]) + 1
|
|
||||||
previousDocument = await Session.get(LeauditDocument, previousVersionId)
|
|
||||||
if previousDocument is not None:
|
|
||||||
previousDocument.isLatestVersion = False
|
|
||||||
else:
|
|
||||||
versionGroupKey = uuid.uuid4().hex
|
|
||||||
|
|
||||||
document = await LeauditDocument.create_new(
|
document = await LeauditDocument.create_new(
|
||||||
Session,
|
Session,
|
||||||
|
|||||||
Reference in New Issue
Block a user