From b985ba69d612bbdebd7294f32ef77f821932c234 Mon Sep 17 00:00:00 2001 From: Jack Eilles Date: Fri, 22 Dec 2023 21:16:10 +0000 Subject: [PATCH] idk when but i broke url --- app/routes.py | 5 ++++- app/worker.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/routes.py b/app/routes.py index 9e627ea..d37676d 100644 --- a/app/routes.py +++ b/app/routes.py @@ -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('/') diff --git a/app/worker.py b/app/worker.py index b9b777f..b70ab7a 100644 --- a/app/worker.py +++ b/app/worker.py @@ -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