fix resource

This commit is contained in:
Looly
2025-04-26 13:15:37 +08:00
parent f8bf24aa0c
commit 51b9bfd8bb
2 changed files with 2 additions and 2 deletions

View File

@@ -315,7 +315,7 @@ public class FileUtil {
// 如果用户需要相对项目路径则使用project:前缀
if (path.startsWith(UrlUtil.PROJECT_URL_PREFIX)) {
return new File(path);
return new File(StrUtil.subSuf(path, UrlUtil.PROJECT_URL_PREFIX.length()));
}
return new File(getAbsolutePath(path));

View File

@@ -77,7 +77,7 @@ public class FileResource implements Resource, Serializable {
* @param fileName 文件名带扩展名如果为null获取文件本身的文件名
*/
public FileResource(final File file, final String fileName) {
this.file = Assert.notNull(file, "File must be not null !");;
this.file = Assert.notNull(file, "File must be not null !");
this.lastModified = file.lastModified();
this.name = ObjUtil.defaultIfNull(fileName, file::getName);
}