diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java b/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java index f40464a133..4c6e598197 100644 --- a/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java +++ b/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java @@ -664,7 +664,7 @@ public HttpResponse file( @Parameter(description = "The execution id") @PathVariable String executionId, @Parameter(description = "The internal storage uri") @QueryValue URI path ) throws IOException, URISyntaxException { - HttpResponse httpResponse = this.validateFile(executionId, path, "/api/v1/executions/{executionId}/file?path=" + path); + HttpResponse httpResponse = this.validateFile(executionId, path, "/api/v1/" + this.getTenant() + "executions/{executionId}/file?path=" + path); if (httpResponse != null) { return httpResponse; } @@ -682,7 +682,7 @@ public HttpResponse filesize( @Parameter(description = "The execution id") @PathVariable String executionId, @Parameter(description = "The internal storage uri") @QueryValue URI path ) throws IOException { - HttpResponse httpResponse = this.validateFile(executionId, path, "/api/v1/executions/{executionId}/file/metas?path=" + path); + HttpResponse httpResponse = this.validateFile(executionId, path, "/api/v1/" + this.getTenant() + "executions/{executionId}/file/metas?path=" + path); if (httpResponse != null) { return httpResponse; } @@ -1445,7 +1445,7 @@ public HttpResponse filePreview( @Parameter(description = "The max row returns") @QueryValue @Nullable Integer maxRows, @Parameter(description = "The file encoding as Java charset name. Defaults to UTF-8", example = "ISO-8859-1") @QueryValue(defaultValue = "UTF-8") String encoding ) throws IOException { - this.validateFile(executionId, path, "/api/v1/executions/{executionId}/file?path=" + path); + this.validateFile(executionId, path, "/api/v1/" + this.getTenant() + "executions/{executionId}/file?path=" + path); String extension = FilenameUtils.getExtension(path.toString()); Optional charset; @@ -1646,4 +1646,8 @@ public List getFlowsByNamespace( return flowRepository.findByNamespaceExecutable(tenantService.resolveTenant(), namespace); } + public String getTenant() { + return tenantService.resolveTenant() != null ? tenantService.resolveTenant() + "/" : ""; + } + }