fix(core): windows backslashes in paths were leading to wrong URI being created leading to error upon execution deletion

This commit is contained in:
brian.mulier
2024-10-07 11:14:55 +02:00
parent 4b2fbe8338
commit 59f10d452a
2 changed files with 4 additions and 3 deletions

View File

@@ -237,7 +237,7 @@ public class LocalStorage implements StorageInterface {
Path prefix = (tenantId == null) ?
basePath.toAbsolutePath() :
Path.of(basePath.toAbsolutePath().toString(), tenantId);
return URI.create("kestra:///" + prefix.relativize(path));
return URI.create("kestra:///" + prefix.relativize(path).toString().replace("\\", "/"));
}
private void parentTraversalGuard(URI uri) {

View File

@@ -694,9 +694,10 @@ public class ExecutionController {
throw new NoSuchElementException("Unable to find execution id '" + executionId + "'");
}
Optional<Flow> flow = flowRepository.findById(execution.get().getTenantId(), execution.get().getNamespace(), execution.get().getFlowId());
String flowId = execution.get().getFlowId();
Optional<Flow> flow = flowRepository.findById(execution.get().getTenantId(), execution.get().getNamespace(), flowId);
if (flow.isEmpty()) {
throw new NoSuchElementException("Unable to find flow id '" + executionId + "'");
throw new NoSuchElementException("Unable to find flow id '" + flowId + "'");
}
String prefix = StorageContext