From ed3eed6bb70c4a9b2d520489dab54729c78c7b21 Mon Sep 17 00:00:00 2001 From: Elijah Date: Tue, 26 May 2026 14:31:36 -0700 Subject: [PATCH] fix: force file downloads via content-disposition attachment --- backend/handlers/files.go | 1 + backend/handlers/sharing.go | 1 + 2 files changed, 2 insertions(+) diff --git a/backend/handlers/files.go b/backend/handlers/files.go index bfb68f6..250affe 100644 --- a/backend/handlers/files.go +++ b/backend/handlers/files.go @@ -1032,6 +1032,7 @@ func (h *FSHandler) Download(c *fiber.Ctx) error { // Set appropriate headers for range requests c.Set("Accept-Ranges", "bytes") c.Set("Content-Type", mime.TypeByExtension(filepath.Ext(resolvedPath))) + c.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", info.Name())) // Use Fiber's built-in SendFile which supports Range requests return c.SendFile(resolvedPath) diff --git a/backend/handlers/sharing.go b/backend/handlers/sharing.go index 8910c52..748f1aa 100644 --- a/backend/handlers/sharing.go +++ b/backend/handlers/sharing.go @@ -417,5 +417,6 @@ func (h *ShareHandler) DownloadPublicShare(c *fiber.Ctx) error { return nil } + c.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", info.Name())) return c.SendFile(fullPath) }