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 ast
import json import json
from datetime import datetime from datetime import datetime
from urllib.parse import quote
from sqlalchemy import create_engine from sqlalchemy import create_engine
from sqlalchemy import Table, Column, ForeignKey, CheckConstraint 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) return u"https://portal.issn.org/resource/ISSN/{0}".format(self.val)
elif format_type == "isfdb": elif format_type == "isfdb":
return u"http://www.isfdb.org/cgi-bin/pl.cgi?{0}".format(self.val) 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: else:
return u"{0}".format(self.val) 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.datastructures import Headers
from werkzeug.security import generate_password_hash from werkzeug.security import generate_password_hash
from markupsafe import escape from markupsafe import escape
from urllib.parse import quote
try:
from urllib.parse import quote
except ImportError:
from urllib import quote
try: try:
import unidecode import unidecode

View File

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

View File

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

View File

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