Fixed a server 500 on missing flooplan image file, which should have returned a 404.

- Legacy-Id: 17689
This commit is contained in:
Henrik Levkowetz 2020-04-25 19:10:06 +00:00
parent 8a7f4ce96e
commit c556820f5f

View file

@ -2335,6 +2335,11 @@ def floor_plan(request, num=None, floor=None, ):
floors = FloorPlan.objects.filter(meeting=meeting).order_by('order')
if floor:
floors = [ f for f in floors if xslugify(f.name) == floor ]
for floor in floors:
try:
floor.image.width
except FileNotFoundError:
raise Http404('Missing floorplan image for %s' % floor)
return render(request, 'meeting/floor-plan.html', {
"schedule": schedule,
"number": num,