Skip to content

Commit

Permalink
Merge pull request #319 from ThomasWaldmann/werkzeug3-compat
Browse files Browse the repository at this point in the history
src: Use urllib.parse.quote instead of werkzeug.url_quote, fixes #312
  • Loading branch information
ThomasWaldmann authored Jan 21, 2024
2 parents 047c7fc + 6e7ed91 commit ea6c37f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
dependencies = [
"werkzeug<3",
"werkzeug",
"Flask",
"markupsafe",
"Pygments>=2.12.0",
Expand Down
4 changes: 2 additions & 2 deletions src/bepasty/apis/lodgeit.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from io import BytesIO
import urllib

from flask import request
from flask.views import MethodView
from pygments.lexers import get_all_lexers
from werkzeug.exceptions import Forbidden
from werkzeug.urls import url_quote

from ..constants import FOREVER
from ..utils.http import redirect_next
Expand Down Expand Up @@ -53,4 +53,4 @@ def post(self):
maxlife_timestamp = FOREVER
name = create_item(f, filename, size, content_type, content_type_hint,
maxlife_stamp=maxlife_timestamp)
return redirect_next('bepasty.display', name=name, _anchor=url_quote(filename))
return redirect_next('bepasty.display', name=name, _anchor=urllib.parse.quote(filename))
4 changes: 2 additions & 2 deletions src/bepasty/views/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import errno
from io import BytesIO
import time
import urllib

from flask import abort, current_app, jsonify, request, url_for
from flask.views import MethodView
from werkzeug.exceptions import NotFound, Forbidden
from werkzeug.urls import url_quote

from ..constants import COMPLETE, FILENAME, SIZE
from ..utils.date_funcs import get_maxlife
Expand Down Expand Up @@ -56,7 +56,7 @@ def post(self):
maxlife_timestamp = int(time.time()) + maxtime if maxtime > 0 else maxtime
name = create_item(f, filename, size, content_type, content_type_hint, maxlife_stamp=maxlife_timestamp)
kw = {}
kw['_anchor'] = url_quote(filename)
kw['_anchor'] = urllib.parse.quote(filename)
if content_type == 'text/x-bepasty-redirect':
# after creating a redirect, we want to stay on the bepasty
# redirect display, so the user can copy the URL.
Expand Down

0 comments on commit ea6c37f

Please sign in to comment.