处理文件配置

This commit is contained in:
wanggeng 2022-07-31 11:05:45 +08:00
parent 55d7a0ea6e
commit 70b899df41
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ public class WebConfig implements WebMvcConfigurer {
// 上传文件的直接访问地址
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())) {
// 网站

View File

@ -194,7 +194,7 @@ public class FileComponent {
if (fileUrl.startsWith("/")) {
fileUrl = fileUrl.substring(1, fileUrl.length() - 1);
}
return fileUrl;
return "files/" + fileUrl;
}
/**