Skip to content

Commit 90d8205

Browse files
committed
fix: Fixed the ability to download a file with read-only permissions
1 parent 225fc5e commit 90d8205

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

web/sharings/drives.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,18 @@ func proxy(fn func(c echo.Context, inst *instance.Instance, s *sharing.Sharing)
597597
}
598598

599599
// For write operations, check if the user has read-only access
600+
// POST /downloads is a read operation (creates temporary download link)
600601
if method == http.MethodPost || method == http.MethodPut ||
601602
method == http.MethodPatch || method == http.MethodDelete {
602-
_, err := checkSharedDrivePermission(inst, c.Param("id"), true)
603-
if err != nil {
604-
return err
603+
// Skip write check for download endpoint (read-only operation)
604+
path := c.Request().URL.Path
605+
isDownload := strings.HasSuffix(path, "/downloads")
606+
607+
if !isDownload {
608+
_, err := checkSharedDrivePermission(inst, c.Param("id"), true)
609+
if err != nil {
610+
return err
611+
}
605612
}
606613
}
607614
}

0 commit comments

Comments
 (0)