mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-1994 update rm errors
This commit is contained in:
+9
-4
@@ -36,6 +36,7 @@ import org.jkiss.utils.CommonUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.time.OffsetDateTime;
|
||||
@@ -266,11 +267,15 @@ public class LocalResourceController implements RMController {
|
||||
throw new DBException("Error creating project path", e);
|
||||
}
|
||||
}
|
||||
Path targetPath = projectPath.resolve(resourcePath).normalize();
|
||||
if (!targetPath.startsWith(projectPath)) {
|
||||
throw new DBException("Invalid resource path");
|
||||
try {
|
||||
Path targetPath = projectPath.resolve(resourcePath).normalize();
|
||||
if (!targetPath.startsWith(projectPath)) {
|
||||
throw new DBException("Invalid resource path");
|
||||
}
|
||||
return targetPath;
|
||||
} catch (InvalidPathException e) {
|
||||
throw new DBException("Resource path contains invalid characters");
|
||||
}
|
||||
return targetPath;
|
||||
}
|
||||
|
||||
private RMProject makeProjectFromPath(Path path, String prefix, boolean checkExistence) {
|
||||
|
||||
Reference in New Issue
Block a user