Commit 14d6bf2e authored by shadMod's avatar shadMod 💬

mv download.py in src/download and rename with views.py

parent 97fdc4aa
# Source code of the Ubuntu-it website
# Copyright (C) 2016 Pietro Albini <pietroalbini@ubuntu.com>
# Copyright (C) 2023 shadMod
# Copyright (C) 2016 Pietro Albini <pietroalbini@ubuntu.com>
# Copyright (C) 2023 shadMod <m.allegro@shadmod.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
......@@ -13,7 +13,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import hashlib
import json
......@@ -26,9 +26,8 @@ import flask
import requests
import itsdangerous
from . import cache
from . import launchpad
from .constants import UITWWW_DIR
from ... import cache
from ... import launchpad
DOWNLOAD_FILE = "downloads.toml"
CACHE_FILE = "download-cache.json"
......@@ -245,8 +244,11 @@ class Downloads:
arch = flask.request.form["arch"]
except KeyError:
flask.abort(400)
raise KeyError
except Exception:
raise Exception
# Validate the input
# Validate the input
if distro not in self.config["distros"]:
flask.abort(400)
if release not in self.config["distros"][distro]["releases"]:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment