Skip to content

Commit

Permalink
fix(payload): Add UTF-8 filename* in Content-Disposition (#332)
Browse files Browse the repository at this point in the history
Fixes #331
Relates-to: #253
  • Loading branch information
YDX-2147483647 authored Sep 1, 2024
1 parent 8b35ad8 commit 3b803b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"log"
"net"
"net/http"
"net/url"
"os"
"os/exec"
"os/signal"
Expand Down Expand Up @@ -219,8 +220,10 @@ func New(cfg *config.Config) (*Server, error) {
// Remove connection from the waitgroup when done
defer waitgroup.Done()
}
w.Header().Set("Content-Disposition", "attachment; filename="+
app.payload.Filename)
w.Header().Set("Content-Disposition", "attachment; filename=\""+
app.payload.Filename+
"\"; filename*=UTF-8''"+
url.QueryEscape(app.payload.Filename))
http.ServeFile(w, r, app.payload.Path)
})
// Upload handler (serves the upload page)
Expand Down

0 comments on commit 3b803b1

Please sign in to comment.