upload small fix

This commit is contained in:
Diamantis Tziotzios 2024-04-10 10:47:05 +03:00
parent abd4f0e5e2
commit 6068878cd4
1 changed files with 6 additions and 3 deletions

View File

@ -492,9 +492,12 @@ public class DescriptionServiceImpl implements DescriptionService {
if (FieldType.isTextType(fieldType)) {
if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())){
StorageFile storageFile = this.storageFileService.copyToStorage(UUID.fromString(persist.getTextValue()), StorageType.Main, true, new BaseFieldSet().ensure(StorageFile._id));
this.storageFileService.updatePurgeAt(storageFile.getId(), null);
data.setTextValue(storageFile.getId().toString());
UUID fileId = this.conventionService.isValidUUID(persist.getTextValue()) ? UUID.fromString(persist.getTextValue()) : null;
if (fileId != null && !this.storageFileService.fileRefExists(fileId.toString(), StorageType.Main)){
StorageFile storageFile = this.storageFileService.copyToStorage(fileId, StorageType.Main, true, new BaseFieldSet().ensure(StorageFile._id));
this.storageFileService.updatePurgeAt(storageFile.getId(), null);
}
data.setTextValue(fileId == null ? null : fileId.toString());
} else {
data.setTextValue(persist.getTextValue());
}