处理文件配置
This commit is contained in:
parent
55d7a0ea6e
commit
70b899df41
@ -37,7 +37,7 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
// 上传文件的直接访问地址
|
// 上传文件的直接访问地址
|
||||||
if (!StringUtils.isBlank(fileProperties.getUploadPath())) {
|
if (!StringUtils.isBlank(fileProperties.getUploadPath())) {
|
||||||
// 静态文件
|
// 静态文件
|
||||||
registry.addResourceHandler("/static-files/**").addResourceLocations("file:" + fileProperties.getUploadPath());
|
registry.addResourceHandler("/files/**").addResourceLocations("file:" + fileProperties.getUploadPath());
|
||||||
}
|
}
|
||||||
if (!StringUtils.isBlank(webProperties.getPath())) {
|
if (!StringUtils.isBlank(webProperties.getPath())) {
|
||||||
// 网站
|
// 网站
|
||||||
|
@ -194,7 +194,7 @@ public class FileComponent {
|
|||||||
if (fileUrl.startsWith("/")) {
|
if (fileUrl.startsWith("/")) {
|
||||||
fileUrl = fileUrl.substring(1, fileUrl.length() - 1);
|
fileUrl = fileUrl.substring(1, fileUrl.length() - 1);
|
||||||
}
|
}
|
||||||
return fileUrl;
|
return "files/" + fileUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user