1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-24 00:50:30 +00:00

Remove python2 urllib imports

Fix for "javascript:" script links in identifier
This commit is contained in:
Ozzieisaacs 2021-12-26 10:31:04 +01:00
parent f39dc100b4
commit 47f5e2ffb4
5 changed files with 9 additions and 18 deletions

View File

@ -23,6 +23,7 @@ import re
import ast
import json
from datetime import datetime
from urllib.parse import quote
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, ForeignKey, CheckConstraint
@ -166,6 +167,8 @@ class Identifiers(Base):
return u"https://portal.issn.org/resource/ISSN/{0}".format(self.val)
elif format_type == "isfdb":
return u"http://www.isfdb.org/cgi-bin/pl.cgi?{0}".format(self.val)
elif self.val.lower().startswith("javascript:"):
return quote(self.val)
else:
return u"{0}".format(self.val)

View File

@ -38,11 +38,8 @@ from sqlalchemy.sql.expression import true, false, and_, text, func
from werkzeug.datastructures import Headers
from werkzeug.security import generate_password_hash
from markupsafe import escape
from urllib.parse import quote
try:
from urllib.parse import quote
except ImportError:
from urllib import quote
try:
import unidecode

View File

@ -23,11 +23,7 @@ import os
import uuid
from time import gmtime, strftime
import json
try:
from urllib import unquote
except ImportError:
from urllib.parse import unquote
from urllib.parse import unquote
from flask import (
Blueprint,

View File

@ -27,10 +27,8 @@
# http://flask.pocoo.org/snippets/62/
try:
from urllib.parse import urlparse, urljoin
except ImportError:
from urlparse import urlparse, urljoin
from urllib.parse import urlparse, urljoin
from flask import request, url_for, redirect

View File

@ -21,11 +21,8 @@ import sys
from base64 import b64decode, b64encode
from jsonschema import validate, exceptions, __version__
from datetime import datetime
try:
# pylint: disable=unused-import
from urllib import unquote
except ImportError:
from urllib.parse import unquote
from urllib.parse import unquote
from flask import json
from .. import logger