Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat: add header into resource response (#2120)

Jianwei Zhangc835231d3233
diff --git a/api/v1/resource.go b/api/v1/resource.go
index ff71d640f..5b5a5f9d0 100644
--- a/api/v1/resource.go
+++ b/api/v1/resource.go
@@ -490,6 +490,7 @@ func (s *APIV1Service) streamResource(c echo.Context) error {
http.ServeContent(c.Response(), c.Request(), resource.Filename, time.Unix(resource.UpdatedTs, 0), bytes.NewReader(blob))
return nil
}
+ c.Response().Writer.Header().Set("Content-Disposition", fmt.Sprintf(`filename="%s"`, resource.Filename))
return c.Stream(http.StatusOK, resourceType, bytes.NewReader(blob))
}