Skip to content

Commit

Permalink
Added quote to filename in Content-Disposition header
Browse files Browse the repository at this point in the history
Following a suggestion from Enrico204

Co-authored-by: Enrico <Enrico204@users.noreply.github.com>
  • Loading branch information
ducalex and Enrico204 committed Apr 4, 2023
1 parent 8e940aa commit 505074a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/restic/cmd_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func runWebServer(ctx context.Context, opts ServeOptions, gopts GlobalOptions, a
}
if len(tree.Nodes) > 0 {
filename := strings.ReplaceAll(strings.Trim(snapshotID+curPath, "/"), "/", "_") + ".tar.gz"
w.Header().Set("Content-Disposition", "attachment; filename="+filename)
w.Header().Set("Content-Disposition", "attachment; filename=\""+filename+"\"")
// For now it's hardcoded to tar because it's the only format that supports all node types correctly
if err := dump.New("tar", repo, w).DumpTree(ctx, &tree, "/"); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down

0 comments on commit 505074a

Please sign in to comment.