From 2a244fca30b458548e3b2a7ea0e78cc8efd4e624 Mon Sep 17 00:00:00 2001 From: "Dominik V. Salonen" Date: Fri, 25 Dec 2015 00:32:58 +0100 Subject: [PATCH] Return link page to avoid auto-downloads --- run.py | 4 ++-- static/style.css | 4 ++-- templates/link.html | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 templates/link.html diff --git a/run.py b/run.py index f0e6f42..443c52e 100755 --- a/run.py +++ b/run.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from flask import Flask, Response, request, redirect, url_for, send_from_directory, abort, render_template +from flask import Flask, request, redirect, url_for, send_from_directory, abort, render_template from werkzeug import secure_filename from threading import Thread import logging @@ -95,7 +95,7 @@ def upload_file(): try: if request.form["source"] == "web": - return redirect(url_for('get_file', filename=filename), code=302) + return render_template('link.html', data=data, page=config["SITE_DATA"]) except Exception: return json.dumps(data) else: diff --git a/static/style.css b/static/style.css index a6993f9..f243ff2 100644 --- a/static/style.css +++ b/static/style.css @@ -63,12 +63,12 @@ body { animation: rise 1s ease-out; } -.links li a { +.links li a, .fileLink { color: inherit; text-decoration: none; } -.links li a:hover { +.links li a:hover, .fileLink { text-decoration: underline; } diff --git a/templates/link.html b/templates/link.html new file mode 100644 index 0000000..32ceecc --- /dev/null +++ b/templates/link.html @@ -0,0 +1,9 @@ +{% extends "shell.html" %} +{% block body %} +

+ Here's your link: +

+

+ {{ data.url }} +

+{% endblock %}