Merge pull request #24621 from ankush/short_circuit_guest

fix: short circuit private files perm check
This commit is contained in:
Ankush Menat 2024-01-30 20:48:42 +05:30 committed by GitHub
commit e1f20f7305
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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