mirror of
https://gitee.com/blossom-editor/blossom.git
synced 2025-12-06 16:58:26 +08:00
fix: 导出为本地文章时图片域名替换
This commit is contained in:
parent
4996bf71b3
commit
e21016272c
@ -209,6 +209,7 @@ public class ArticleBackupService {
|
||||
if (toLocal == YesNo.YES) {
|
||||
backLogs.add("");
|
||||
if (articleId != null) {
|
||||
// 查询文章引用的图片
|
||||
List<ArticleReferenceEntity> refs = referenceService.listPics(articleId);
|
||||
PictureEntity where = new PictureEntity();
|
||||
where.setUrls(refs.stream().map(ArticleReferenceEntity::getTargetUrl).collect(Collectors.toList()));
|
||||
@ -216,11 +217,16 @@ public class ArticleBackupService {
|
||||
backLogs.add("[图片备份] 图片个数: " + pics.size());
|
||||
backLogs.add("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ↓↓ 图片列表 ↓↓ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
||||
for (PictureEntity pic : pics) {
|
||||
backLogs.add("┃ " + pic.getPathName());
|
||||
try {
|
||||
FileUtil.copy(
|
||||
pic.getPathName(),
|
||||
backupFile.getRootPath() + "/" + pic.getPathName(),
|
||||
true);
|
||||
backLogs.add("┃ " + pic.getPathName());
|
||||
} catch (Exception e) {
|
||||
backLogs.add("┃ [警告] " + pic.getPathName() + " 未在存储路径中找到");
|
||||
log.warn("{} 未在存储路径中找到", pic.getPathName());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 备份全部图片
|
||||
@ -378,7 +384,7 @@ public class ArticleBackupService {
|
||||
}
|
||||
|
||||
List<ArticleReferenceEntity> refs = referenceService.listPics(articleId);
|
||||
final String domain = iaasProperties.getBlos().getDomain();
|
||||
final String domain = paramService.getDomain();
|
||||
|
||||
// 计算字符出现的次数
|
||||
int separatorCount = countChar(articleName, '/');
|
||||
|
||||
@ -173,7 +173,11 @@ public class IaasProperties {
|
||||
public static class BLOS {
|
||||
/**
|
||||
* BLOS 查看图片的接口的地址, 默认在 PictureController#getFile() 方法中, 末尾带有 "/" 会自动清除
|
||||
*
|
||||
* @deprecated 该配置项已转移至系统配置 base_sys_param {@link ParamEnum#BLOSSOM_OBJECT_STORAGE_DOMAIN},
|
||||
* 但在 base_sys_param 为配置时仍然生效
|
||||
*/
|
||||
@Deprecated
|
||||
private String domain;
|
||||
/**
|
||||
* BLOS 默认上传地址, 不能为空, 注意不同系统的区分, 末尾带有 "/" 会自动清除
|
||||
@ -202,7 +206,7 @@ public class IaasProperties {
|
||||
}
|
||||
if (blos != null) {
|
||||
String domain = formatDomain(blos.getDomain());
|
||||
if (!StrUtil.endWith(domain,"/pic")) {
|
||||
if (!StrUtil.endWith(domain, "/pic")) {
|
||||
domain = domain + "/pic";
|
||||
}
|
||||
blos.setDomain(domain);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user