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,
|
||||
)
|
||||
|
||||
if latestCandidate and latestCandidate["sha256"] == fileSha256:
|
||||
duplicateUpload = True
|
||||
document = await Session.get(LeauditDocument, int(latestCandidate["document_id"]))
|
||||
documentFile = await Session.get(LeauditDocumentFile, int(latestCandidate["file_id"]))
|
||||
if document is None or documentFile is None:
|
||||
raise LeauditException(StatusCodeEnum.HTTP_500_INTERNAL_SERVER_ERROR, "重复上传版本定位失败")
|
||||
await Session.commit()
|
||||
internalDocumentNo = time.time_ns()
|
||||
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:
|
||||
internalDocumentNo = time.time_ns()
|
||||
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
|
||||
versionGroupKey = uuid.uuid4().hex
|
||||
|
||||
document = await LeauditDocument.create_new(
|
||||
Session,
|
||||
|
||||
Reference in New Issue
Block a user