mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix resource
This commit is contained in:
@@ -315,7 +315,7 @@ public class FileUtil {
|
|||||||
|
|
||||||
// 如果用户需要相对项目路径,则使用project:前缀
|
// 如果用户需要相对项目路径,则使用project:前缀
|
||||||
if (path.startsWith(UrlUtil.PROJECT_URL_PREFIX)) {
|
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));
|
return new File(getAbsolutePath(path));
|
||||||
|
@@ -77,7 +77,7 @@ public class FileResource implements Resource, Serializable {
|
|||||||
* @param fileName 文件名,带扩展名,如果为null获取文件本身的文件名
|
* @param fileName 文件名,带扩展名,如果为null获取文件本身的文件名
|
||||||
*/
|
*/
|
||||||
public FileResource(final File file, final String fileName) {
|
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.lastModified = file.lastModified();
|
||||||
this.name = ObjUtil.defaultIfNull(fileName, file::getName);
|
this.name = ObjUtil.defaultIfNull(fileName, file::getName);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user