fix: short circuit private files perm check
For guest users there's no point in checking permissions, they'll eventually fail... instead just fail immediately.
This commit is contained in:
parent
a378c8bee2
commit
d838da51dd
1 changed files with 3 additions and 0 deletions
|
|
@ -265,6 +265,9 @@ def download_backup(path):
|
|||
def download_private_file(path: str) -> Response:
|
||||
"""Checks permissions and sends back private file"""
|
||||
|
||||
if frappe.session.user == "Guest":
|
||||
raise Forbidden(_("You don't have permission to access this file"))
|
||||
|
||||
files = frappe.get_all("File", filters={"file_url": path}, fields="*")
|
||||
# this file might be attached to multiple documents
|
||||
# if the file is accessible from any one of those documents
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue