mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 08:22:10 +01:00 
			
		
		
		
	404 error rather than 403 when media is not found
This commit is contained in:
		@@ -4,7 +4,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
 | 
			
		||||
from django.contrib.auth.models import AnonymousUser
 | 
			
		||||
from django.core.exceptions import PermissionDenied
 | 
			
		||||
from django.db.models import Q
 | 
			
		||||
from django.http import FileResponse
 | 
			
		||||
from django.http import FileResponse, Http404
 | 
			
		||||
from django.shortcuts import redirect
 | 
			
		||||
from django.urls import reverse_lazy
 | 
			
		||||
from django.utils import timezone
 | 
			
		||||
@@ -188,7 +188,11 @@ class DocumentView(LoginRequiredMixin, View):
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def get(self, request, *args, **kwargs):
 | 
			
		||||
        doc = Document.objects.get(file=self.kwargs["file"])
 | 
			
		||||
        try:
 | 
			
		||||
            doc = Document.objects.get(file=self.kwargs["file"])
 | 
			
		||||
        except Document.DoesNotExist:
 | 
			
		||||
            raise Http404(_("No %(verbose_name)s found matching the query") %
 | 
			
		||||
                          {'verbose_name': Document._meta.verbose_name})
 | 
			
		||||
 | 
			
		||||
        grant = request.user.admin
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user