Source: bepasty
Version: 1.2.0-2
Severity: normal

Dear Maintainer,

while preparing the upload of Flask 3.x and the depending Werkzeug 3.x
package I noticed that bepasty is FTBFS in case these packages with
versions >= 3.x are around in the chroot.

This is mostly happen as bepasty upstream isn't ready for these newer
versions.

https://github.com/bepasty/bepasty-server/issues/312

The failing test for amd64 is visible here:
https://ci.debian.net/packages/b/bepasty/unstable/amd64/41844896/

Fixing this issue isn't that difficult, instead of depending on
functionality from Werkzeug it's easier to use urllib from the Python
stdlib implementaion.

Similar to how a PR in flask-openid is targeting a fix on the same
problem in their source bepasty can be using the same attempt.

https://github.com/pallets-eco/flask-openid/pull/71/files

I added a patch to apply for convenience.

I intend to raise the severity for this report once we finalized
preparation for uploading Flask and Werkzeug 3.x into unstable.

Regards
Carsten

-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.5.0-5-amd64 (SMP w/20 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
>From c34083257ced9d3034553c624a68878ec23ac4eb Mon Sep 17 00:00:00 2001
From: Carsten Schoenert <[email protected]>
Date: Sun, 21 Jan 2024 10:34:31 +0100
Subject: [PATCH] Rebuild patch queue from patch-queue branch

Added patch:
0006-src-Use-urllib.parse.quote-instead-of-werkzeug.url_q.patch

Fixes potentially issues while running the tests with installed packages
of Flask and Werkzeug which are greater than 3.x.
---
 ...arse.quote-instead-of-werkzeug.url_q.patch | 58 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 59 insertions(+)
 create mode 100644 
debian/patches/0006-src-Use-urllib.parse.quote-instead-of-werkzeug.url_q.patch

diff --git 
a/debian/patches/0006-src-Use-urllib.parse.quote-instead-of-werkzeug.url_q.patch
 
b/debian/patches/0006-src-Use-urllib.parse.quote-instead-of-werkzeug.url_q.patch
new file mode 100644
index 0000000..bcb5d74
--- /dev/null
+++ 
b/debian/patches/0006-src-Use-urllib.parse.quote-instead-of-werkzeug.url_q.patch
@@ -0,0 +1,58 @@
+From: Carsten Schoenert <[email protected]>
+Date: Sun, 21 Jan 2024 09:24:14 +0100
+Subject: src: Use urllib.parse.quote instead of werkzeug.url_quote
+
+Forwared: https://github.com/bepasty/bepasty-server/issues/312
+---
+ src/bepasty/apis/lodgeit.py | 4 ++--
+ src/bepasty/views/upload.py | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/bepasty/apis/lodgeit.py b/src/bepasty/apis/lodgeit.py
+index 980cb9e..9482f48 100644
+--- a/src/bepasty/apis/lodgeit.py
++++ b/src/bepasty/apis/lodgeit.py
+@@ -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
+@@ -53,4 +53,4 @@ class LodgeitUpload(MethodView):
+         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))
+diff --git a/src/bepasty/views/upload.py b/src/bepasty/views/upload.py
+index fe3526b..88b778f 100644
+--- a/src/bepasty/views/upload.py
++++ b/src/bepasty/views/upload.py
+@@ -2,11 +2,11 @@ import os
+ 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
+@@ -56,7 +56,7 @@ class UploadView(MethodView):
+         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.
diff --git a/debian/patches/series b/debian/patches/series
index 342bea7..779be17 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
 0003-Correct-for-different-file-paths-in-the-debian-insta.patch
 0004-Fallback-to-Chromium-if-selenium-can-t-use-Firefox.patch
 0005-Skip-a-test-that-is-known-to-fail.patch
+0006-src-Use-urllib.parse.quote-instead-of-werkzeug.url_q.patch
-- 
2.43.0

Reply via email to