chore: 优化部分代码

This commit is contained in:
2024-05-31 00:30:45 +08:00
parent 694cbb2850
commit a3391647b5
4 changed files with 18 additions and 18 deletions

View File

@@ -146,7 +146,7 @@ public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileRes
super.fill(obj);
if (obj instanceof FileResp fileResp && !URLUtils.isHttpUrl(fileResp.getUrl())) {
StorageDO storage = storageService.getById(fileResp.getStorageId());
String prefix = storage.getDomain() + StringConstants.SLASH;
String prefix = StrUtil.appendIfMissing(storage.getDomain(), StringConstants.SLASH);
String url = URLUtil.normalize(prefix + fileResp.getUrl());
fileResp.setUrl(url);
String thumbnailUrl = StrUtils.blankToDefault(fileResp.getThumbnailUrl(), url, thUrl -> URLUtil