mirror of
https://github.com/jackeilles/xygt.git
synced 2024-11-28 01:32:40 +01:00
idk when but i broke url
This commit is contained in:
parent
c3214af880
commit
b985ba69d6
2 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
from app import app, worker
|
from app import app, worker
|
||||||
from config import Config, Errors
|
from config import Config, Errors
|
||||||
from flask import render_template, request, send_file
|
from flask import render_template, request, send_file, redirect
|
||||||
from werkzeug.datastructures import FileStorage
|
from werkzeug.datastructures import FileStorage
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
@ -55,6 +55,9 @@ def index():
|
||||||
return result, status
|
return result, status
|
||||||
|
|
||||||
elif 'url' in request.form:
|
elif 'url' in request.form:
|
||||||
|
|
||||||
|
url = request.form['url']
|
||||||
|
|
||||||
result, status = worker.shortURL(url, ip, userid, id, retention)
|
result, status = worker.shortURL(url, ip, userid, id, retention)
|
||||||
|
|
||||||
@app.route('/<id>')
|
@app.route('/<id>')
|
||||||
|
|
|
@ -98,11 +98,11 @@ def shortenURL(url, ip, userid, id, retention):
|
||||||
def idInfo(id):
|
def idInfo(id):
|
||||||
# Check files and url for the ID
|
# Check files and url for the ID
|
||||||
if Config.files.find_one({"id": id}) is not None:
|
if Config.files.find_one({"id": id}) is not None:
|
||||||
check = Config.files.find_one({"id": id}, {'_id': False}, {"ip": False})
|
check = Config.files.find_one({"id": id}, {'_id': False, "ip": False})
|
||||||
# "ip": False removes the IP from the returned data.
|
# "ip": False removes the IP from the returned data.
|
||||||
# If it's not there then check url
|
# If it's not there then check url
|
||||||
elif Config.url.find_one({"id": id}) is not None:
|
elif Config.url.find_one({"id": id}) is not None:
|
||||||
check = Config.url.find_one({"id": id}, {'_id': False}, {"ip": False})
|
check = Config.url.find_one({"id": id}, {'_id': False, "ip": False})
|
||||||
|
|
||||||
# Return the mongodb info about the file, removing IP if its present
|
# Return the mongodb info about the file, removing IP if its present
|
||||||
return check
|
return check
|
||||||
|
|
Loading…
Reference in a new issue