From 88d443e13090dc9298031ff8dbb48f3e0a54e585 Mon Sep 17 00:00:00 2001 From: creme Date: Wed, 18 Sep 2019 15:41:00 +0200 Subject: Pass back file/url/shorten as `text/plain` --- fhost.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'fhost.py') diff --git a/fhost.py b/fhost.py index 708f103..1e8c85d 100755 --- a/fhost.py +++ b/fhost.py @@ -330,14 +330,17 @@ def dump_urls(start=0): @app.route("/", methods=["GET", "POST"]) def fhost(): if request.method == "POST": - sf = None + out = None if "file" in request.files: - return store_file(request.files["file"], request.remote_addr) + out = store_file(request.files["file"], request.remote_addr) elif "url" in request.form: - return store_url(request.form["url"], request.remote_addr) + out = store_url(request.form["url"], request.remote_addr) elif "shorten" in request.form: - return shorten(request.form["shorten"]) + out = shorten(request.form["shorten"]) + + if not out == None: + return Response(out, mimetype="text/plain") abort(400) else: -- cgit