Skip to content

Commit

Permalink
fix(webserver): missing params in file paths (#4966)
Browse files Browse the repository at this point in the history
close #4958
  • Loading branch information
Skraye committed Sep 20, 2024
1 parent 7588721 commit 2cf9104
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public HttpResponse<StreamedFile> file(
@Parameter(description = "The execution id") @PathVariable String executionId,
@Parameter(description = "The internal storage uri") @QueryValue URI path
) throws IOException, URISyntaxException {
HttpResponse<StreamedFile> httpResponse = this.validateFile(executionId, path, "/api/v1/executions/{executionId}/file?path=" + path);
HttpResponse<StreamedFile> httpResponse = this.validateFile(executionId, path, "/api/v1/" + this.getTenant() + "executions/{executionId}/file?path=" + path);
if (httpResponse != null) {
return httpResponse;
}
Expand All @@ -672,7 +672,7 @@ public HttpResponse<FileMetas> filesize(
@Parameter(description = "The execution id") @PathVariable String executionId,
@Parameter(description = "The internal storage uri") @QueryValue URI path
) throws IOException {
HttpResponse<FileMetas> httpResponse = this.validateFile(executionId, path, "/api/v1/executions/{executionId}/file/metas?path=" + path);
HttpResponse<FileMetas> httpResponse = this.validateFile(executionId, path, "/api/v1/" + this.getTenant() + "executions/{executionId}/file/metas?path=" + path);
if (httpResponse != null) {
return httpResponse;
}
Expand Down Expand Up @@ -1296,7 +1296,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> charset;
Expand Down Expand Up @@ -1495,4 +1495,8 @@ public List<FlowForExecution> getFlowsByNamespace(
return flowRepository.findByNamespaceExecutable(tenantService.resolveTenant(), namespace);
}

public String getTenant() {
return tenantService.resolveTenant() != null ? tenantService.resolveTenant() + "/" : "";
}

}

0 comments on commit 2cf9104

Please sign in to comment.