idk when but i broke url

This commit is contained in:
Jack Eilles 2023-12-22 21:16:10 +00:00
parent c3214af880
commit b985ba69d6
2 changed files with 6 additions and 3 deletions

View file

@ -1,6 +1,6 @@
from app import app, worker
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.utils import secure_filename
from io import BytesIO
@ -55,6 +55,9 @@ def index():
return result, status
elif 'url' in request.form:
url = request.form['url']
result, status = worker.shortURL(url, ip, userid, id, retention)
@app.route('/<id>')

View file

@ -98,11 +98,11 @@ def shortenURL(url, ip, userid, id, retention):
def idInfo(id):
# Check files and url for the ID
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.
# If it's not there then check url
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 check