Skip to content
Snippets Groups Projects
Commit 08dd6938 authored by Jonas Leder's avatar Jonas Leder
Browse files

fixed links in userprofile

parent c2d14733
No related branches found
No related tags found
No related merge requests found
Pipeline #172 passed
......@@ -160,7 +160,7 @@ def redirectOwnLinks():
@app.route('/user/links<pageNumber>')#This function gives the user the posibility to see and delete his links
def ownLinks(pageNumber):
return userProfile(request, cookieNotice, s, pageNumber)
return userProfile(request, cookieNotice, s, pageNumber, url_scheme)
@app.route('/user/delete') #This function is called if a user deletes an entrie
def delete():
......
......@@ -2,7 +2,7 @@ import sqlite3
from flask import redirect, abort, render_template
from html import escape #This is used to escape characters, if they are send in the url
def userProfile(request, cookieNotice, s, pageNumber):
def userProfile(request, cookieNotice, s, pageNumber, url_scheme):
backButton = 0
nextButton = 0
lenEntries = 0
......@@ -32,7 +32,7 @@ def userProfile(request, cookieNotice, s, pageNumber):
calls = str(cursor2.execute('SELECT CALLS FROM ANALYTICS WHERE SHORT_URL=?', [entries[1]]).fetchone()[0])
except:
calls = "0"
response = response + "<tr>\n<td>" + entries[0] + "</td>\n<td><a href=\"" + entries[1] + '">' + entries[1] + '</a></td>\n<td>' + calls + '</td>\n<td><a id="red" href="/user/delete?link=' + escape(entries[1]) + '">delete</a> <a href="#" id="dialog-link" onclick="buttonListener(\'' + entries[1] + '\', this)">QR</a></tr>\n'
response = response + "<tr>\n<td>" + entries[0] + "</td>\n<td><a href=\"" + url_scheme + "://" + entries[1] + '">' + entries[1] + '</a></td>\n<td>' + calls + '</td>\n<td><a id="red" href="/user/delete?link=' + escape(entries[1]) + '">delete</a> <a href="#" id="dialog-link" onclick="buttonListener(\'' + entries[1] + '\', this)">QR</a></tr>\n'
response = response + "</table>" #Close the table
if(len(entriesList) == 0): response = 'you have no shorten links.' #If user has no shorten links make this message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment