导出时,如果配置的magic-api.resource.prefix为/,则导出的内容无法导入

This commit is contained in:
chenzhenwei
2024-07-29 16:54:18 +08:00
parent 41f2cf53c6
commit 6aabbaf3c7
2 changed files with 2 additions and 2 deletions

View File

@@ -146,7 +146,7 @@ public class FileResource implements Resource {
parent = parent.parent();
}
String path = this.getAbsolutePath()
.replace(parent.getAbsolutePath(), "")
.substring(parent.getAbsolutePath().length())
.replace("\\", "/");
if (isDirectory() && !path.endsWith("/")) {
path += "/";

View File

@@ -175,7 +175,7 @@ public abstract class KeyValueResource implements Resource {
parent = parent.parent();
}
String path = this.getAbsolutePath()
.replace(parent.getAbsolutePath(), "")
.substring(parent.getAbsolutePath().length())
.replace("\\", "/")
.replace(this.separator, "/");
return path.startsWith("/") ? path.substring(1) : path;