From 76f9f1b1028463ba544eec9468429ff5e8dcc94c Mon Sep 17 00:00:00 2001 From: Julien Constant Date: Sat, 8 Apr 2023 23:58:28 +0200 Subject: [PATCH] Added back the permission denied --- core/views/files.py | 4 ++-- locale/fr/LC_MESSAGES/django.po | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/views/files.py b/core/views/files.py index 7dedade2..88ca6897 100644 --- a/core/views/files.py +++ b/core/views/files.py @@ -26,6 +26,7 @@ from django.utils.translation import gettext_lazy as _ from django.http import HttpResponse from wsgiref.util import FileWrapper from django.urls import reverse +from django.core.exceptions import PermissionDenied from django import forms import os @@ -38,7 +39,6 @@ from core.views import ( CanEditMixin, CanEditPropMixin, can_view, - forbidden, not_found, ) from counter.models import Counter @@ -61,7 +61,7 @@ def send_file(request, file_id, file_class=SithFile, file_attr="file"): ).exists() ) ): - return forbidden(request, _("You are not allowed to view this file")) + raise PermissionDenied name = f.__getattribute__(file_attr).name filepath = os.path.join(settings.MEDIA_ROOT, name) diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index e93c947c..71301599 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -2523,10 +2523,6 @@ msgstr "Fichiers" msgid "File not found" msgstr "Fichier introuvable" -#: core/views/files.py:64 -msgid "You are not allowed to view this file" -msgstr "Vous n'êtes pas autorisé à voir ce fichier" - #: core/templates/core/base.jinja:202 core/templates/core/user_tools.jinja:109 msgid "Pedagogy" msgstr "Pédagogie"