WebClient/HTTP API: ensure to check home dir, when needed, in multi-node setups

Behind a load balancer with no sticky sessions enabled is not enough to check
the home dir only when the client logs in

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-09-07 16:23:56 +02:00
parent 3ebdfa9b2d
commit 63e3891808
5 changed files with 9 additions and 2 deletions

View File

@@ -232,6 +232,7 @@ func getCompressedFileName(username string, files []string) string {
func renderCompressedFiles(w http.ResponseWriter, conn *Connection, baseDir string, files []string,
share *dataprovider.Share,
) {
conn.User.CheckFsRoot(conn.ID) //nolint:errcheck
w.Header().Set("Content-Type", "application/zip")
w.Header().Set("Accept-Ranges", "none")
w.Header().Set("Content-Transfer-Encoding", "binary")
@@ -326,6 +327,7 @@ func checkDownloadFileFromShare(share *dataprovider.Share, info os.FileInfo) err
func downloadFile(w http.ResponseWriter, r *http.Request, connection *Connection, name string,
info os.FileInfo, inline bool, share *dataprovider.Share,
) (int, error) {
connection.User.CheckFsRoot(connection.ID) //nolint:errcheck
err := checkDownloadFileFromShare(share, info)
if err != nil {
return http.StatusBadRequest, err