Add Content-Length and Content-Disposition Header

for GetFileContent route.
This commit is contained in:
Maximilian Paß
2022-09-28 21:49:35 +01:00
parent 0c70ad3b24
commit 195f88177e
10 changed files with 161 additions and 28 deletions

View File

@ -139,7 +139,7 @@ func (r *RunnerController) fileContent(writer http.ResponseWriter, request *http
privilegedExecution = false
}
writer.Header().Set("Content-Type", "application/octet-stream")
writer.Header().Set("Content-Disposition", "attachment; filename=\""+path+"\"")
err = targetRunner.GetFileContent(path, writer, privilegedExecution, request.Context())
if errors.Is(err, runner.ErrFileNotFound) {
writeClientError(writer, err, http.StatusFailedDependency)