Add the authors to the download filename

This commit is contained in:
Las Zenow 2020-11-18 12:00:19 +00:00
parent c82fd09e0d
commit 94c75b1d2a

View file

@ -117,7 +117,7 @@ func downloadHandler(h handler) {
headers := h.w.Header()
headers["Content-Type"] = []string{"application/epub+zip"}
headers["Content-Disposition"] = []string{"attachment; filename=\"" + book.Title + ".epub\""}
headers["Content-Disposition"] = []string{fmt.Sprintf("attachment; filename=\"%s - %s.epub\"", strings.Join(book.Authors, ", "), book.Title)}
headers["Content-Length"] = []string{fmt.Sprint(book.FileSize)}
headers["Last-Modified"] = []string{fmt.Sprint(book.UploadDate.Format(time.RFC1123))}
addCacheControlHeader(h.w, false)