mirror of
https://github.com/ae-utbm/sith.git
synced 2025-09-15 12:33:54 +00:00
Added back the permission denied
This commit is contained in:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user