Always generate public resource key if missing
This commit is contained in:
parent
927479095f
commit
04fea1e2db
@ -150,13 +150,11 @@ public class BaseImageService extends BaseResourceService implements ImageServic
|
||||
image.setDescriptorValue(descriptor);
|
||||
image.setPreview(result.getRight());
|
||||
|
||||
if (image.getId() == null) {
|
||||
if (StringUtils.isEmpty(image.getPublicResourceKey())) {
|
||||
if (StringUtils.isEmpty(image.getPublicResourceKey())) {
|
||||
image.setPublicResourceKey(generatePublicResourceKey());
|
||||
} else {
|
||||
if (resourceInfoDao.existsByPublicResourceKey(ResourceType.IMAGE, image.getPublicResourceKey())) {
|
||||
image.setPublicResourceKey(generatePublicResourceKey());
|
||||
} else {
|
||||
if (resourceInfoDao.existsByPublicResourceKey(ResourceType.IMAGE, image.getPublicResourceKey())) {
|
||||
image.setPublicResourceKey(generatePublicResourceKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("[{}] Creating image {} ('{}')", image.getTenantId(), image.getResourceKey(), image.getName());
|
||||
@ -292,7 +290,8 @@ public class BaseImageService extends BaseResourceService implements ImageServic
|
||||
return resourceInfoDao.findSystemOrTenantImageByEtag(tenantId, ResourceType.IMAGE, etag);
|
||||
}
|
||||
|
||||
@Transactional(noRollbackFor = Exception.class) // we don't want transaction to rollback in case of an image processing failure
|
||||
@Transactional(noRollbackFor = Exception.class)
|
||||
// we don't want transaction to rollback in case of an image processing failure
|
||||
@Override
|
||||
public boolean replaceBase64WithImageUrl(HasImage entity, String type) {
|
||||
log.trace("Executing replaceBase64WithImageUrl [{}] [{}] [{}]", entity.getTenantId(), type, entity.getName());
|
||||
@ -307,7 +306,8 @@ public class BaseImageService extends BaseResourceService implements ImageServic
|
||||
return result.isUpdated();
|
||||
}
|
||||
|
||||
@Transactional(noRollbackFor = Exception.class) // we don't want transaction to rollback in case of an image processing failure
|
||||
@Transactional(noRollbackFor = Exception.class)
|
||||
// we don't want transaction to rollback in case of an image processing failure
|
||||
@Override
|
||||
public boolean replaceBase64WithImageUrl(WidgetTypeDetails entity) {
|
||||
log.trace("Executing replaceBase64WithImageUrl [{}] [WidgetTypeDetails] [{}]", entity.getTenantId(), entity.getId());
|
||||
@ -333,7 +333,8 @@ public class BaseImageService extends BaseResourceService implements ImageServic
|
||||
return updated;
|
||||
}
|
||||
|
||||
@Transactional(noRollbackFor = Exception.class) // we don't want transaction to rollback in case of an image processing failure
|
||||
@Transactional(noRollbackFor = Exception.class)
|
||||
// we don't want transaction to rollback in case of an image processing failure
|
||||
@Override
|
||||
public boolean replaceBase64WithImageUrl(Dashboard entity) {
|
||||
log.trace("Executing replaceBase64WithImageUrl [{}] [Dashboard] [{}]", entity.getTenantId(), entity.getId());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user