Skip to content

Commit

Permalink
Add filename to image serve (stashapp#4616)
Browse files Browse the repository at this point in the history
  • Loading branch information
NodudeWasTaken authored and halkeye committed Sep 1, 2024
1 parent db3f04b commit a870624
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/models/model_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ func (f *BaseFile) Serve(fs FS, w http.ResponseWriter, r *http.Request) error {
} else {
w.Header().Set("Cache-Control", "no-cache")
}

// Set filename if not previously set
if w.Header().Get("Content-Disposition") == "" {
w.Header().Set("Content-Disposition", fmt.Sprintf("filename=%s", f.Basename))
}

http.ServeContent(w, r, f.Basename, f.ModTime, content)

return nil
Expand Down

0 comments on commit a870624

Please sign in to comment.