feat: share link

This commit is contained in:
vxclutch
2026-05-28 08:25:59 -04:00
parent 363c3b6c96
commit d18838dfee
6 changed files with 46 additions and 2 deletions

View File

@@ -40,3 +40,13 @@ func (h FileData) APIHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write(h.Contents)
}
func (h FileData) FileHandler(w http.ResponseWriter, r *http.Request) {
// Send the file over as a stream of bytes
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", h.FileName))
w.Header().Set("Content-Type", "application/octet-stream")
w.Header().Set("Content-Length", strconv.Itoa(len(h.Contents)))
w.WriteHeader(http.StatusOK)
w.Write(h.Contents)
}