diff options
author | Alexander Sulfrian <asulfrian@zedat.fu-berlin.de> | 2022-01-06 19:09:38 +0100 |
---|---|---|
committer | Alexander Sulfrian <asulfrian@zedat.fu-berlin.de> | 2022-01-06 19:09:38 +0100 |
commit | b2acff1955cd2c95382624a2faf5731874a0c54b (patch) | |
tree | 5a98d6e6f49b2d183307d28c76270ee6ea4842fd | |
parent | 6f9ac78549d4b96a51bf585fca7e8e5dc54b7808 (diff) | |
download | klausuren-b2acff1955cd2c95382624a2faf5731874a0c54b.tar.gz klausuren-b2acff1955cd2c95382624a2faf5731874a0c54b.tar.bz2 klausuren-b2acff1955cd2c95382624a2faf5731874a0c54b.zip |
Return 404 if study is not found
-rw-r--r-- | app/main.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/main.py b/app/main.py index 1934c23..8ca26bc 100644 --- a/app/main.py +++ b/app/main.py @@ -2,7 +2,7 @@ import os, sys from flask import Blueprint, render_template, request, flash, redirect,\ - url_for, current_app, g + url_for, current_app, g, abort from werkzeug.utils import secure_filename from wtforms.validators import ValidationError from .backend import Storage @@ -76,7 +76,11 @@ def upload(study, course = None): @main.route('/<study>/courses/<course>') def courses_show(study, course = None): """ Lists all courses or exams for a course """ - backend = get_studies()[study] + studies = get_studies() + if study not in studies: + abort(404) + + backend = studies[study] if course: entries = sorted(backend.get_exams(course), reverse = True) return render_template('exams.html', study = study, course = course, |