Commit 75beeb5e authored by Jörg Richter's avatar Jörg Richter

Fix: FilesService on Windows (#387)

parent ad70c0b2
Pipeline #10653 passed with stages
in 8 minutes and 50 seconds
......@@ -492,7 +492,7 @@ public class FilesPlugin extends PluginActivator implements FilesService, Static
@Override
public String repoPath(File path) {
try {
String repoPath = path.getPath();
String repoPath = getPath(path);
//
if (!repoPath.startsWith(FILE_REPOSITORY_PATH)) {
throw new RuntimeException("Absolute path \"" + path + "\" is not a repository path");
......@@ -735,7 +735,7 @@ public class FilesPlugin extends PluginActivator implements FilesService, Static
// Note: a directory path returned by getCanonicalPath() never contains a "/" at the end.
// Thats why "dmx.filerepo.path" is expected to have no "/" at the end as well.
path = path.getCanonicalFile(); // throws IOException
boolean pointsToRepository = path.getPath().startsWith(FILE_REPOSITORY_PATH);
boolean pointsToRepository = getPath(path).startsWith(FILE_REPOSITORY_PATH);
//
logger.fine("Checking path \"" + path + "\"\n dmx.filerepo.path=" +
"\"" + FILE_REPOSITORY_PATH + "\" => " + (pointsToRepository ? "PATH OK" : "FORBIDDEN"));
......@@ -859,7 +859,7 @@ public class FilesPlugin extends PluginActivator implements FilesService, Static
String repoPath = null;
String requestURI = request.getRequestURI();
if (requestURI.startsWith(FILE_REPOSITORY_URI)) {
// Note: the request URI is e.g. /filerepo/%2Fworkspace-1821%2Flogo-escp-europe.gif
// Note: the request URI is e.g. /filerepo/%2Fworkspace-1234%2Flogo.gif
// +1 cuts off the slash following /filerepo
repoPath = requestURI.substring(FILE_REPOSITORY_URI.length() + 1);
repoPath = JavaUtils.decodeURIComponent(repoPath);
......@@ -867,6 +867,16 @@ public class FilesPlugin extends PluginActivator implements FilesService, Static
return repoPath;
}
// --- System independent File API wrapper ---
private String getPath(File file) {
return replaceBS(file.getPath()); // Note: getPath() is system dependent
}
private String replaceBS(String path) {
return path.replace("\\", "/");
}
// --- Per-workspace file repositories ---
private void createWorkspaceFileRepository(File repo) {
......
......@@ -8,7 +8,7 @@
</div>
<div class="field">
<div class="field-label">Released</div>
Jul 28, 2020
Jul 30, 2020
</div>
<div class="field">
<div class="field-label">License</div>
......
......@@ -9,7 +9,7 @@ import extraElementUI from './element-ui'
import 'font-awesome/css/font-awesome.css'
import './websocket'
console.log('[DMX] 2020/07/28')
console.log('[DMX] 2020/07/30')
// 1) Init dm5 library
// The dm5 library must be inited *before* the dm5-webclient component is instantiated.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment