This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 48df312  Patch asfquart to use clean login URLs
48df312 is described below

commit 48df3126c2cbec4463055ac0976fc3fe9ef17cdc
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Sep 15 14:35:18 2025 +0100

    Patch asfquart to use clean login URLs
---
 Dockerfile.alpine         |  6 +++++-
 Dockerfile.ubuntu         |  6 +++++-
 Makefile                  |  6 +++++-
 patches/generics.py.patch | 31 +++++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Dockerfile.alpine b/Dockerfile.alpine
index a2ef358..fedd538 100644
--- a/Dockerfile.alpine
+++ b/Dockerfile.alpine
@@ -8,8 +8,9 @@ ENV PIP_DEFAULT_TIMEOUT=100 \
 
 RUN apk update && \
     apk add --no-cache \
+      git \
       make \
-      git
+      patch
 
 RUN pip3 install uv==${UV_VERSION}
 
@@ -25,6 +26,9 @@ RUN make sync
 # generate a version.py module from git information
 RUN make generate-version
 
+WORKDIR /opt/atr/.venv/lib/python3.13/site-packages
+RUN patch -p2 < /opt/atr/patches/generics.py.patch
+
 # final image
 FROM python:3.13.7-alpine3.22
 
diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu
index 1d65e0e..e6c15d5 100644
--- a/Dockerfile.ubuntu
+++ b/Dockerfile.ubuntu
@@ -9,8 +9,9 @@ ENV PIP_DEFAULT_TIMEOUT=100 \
 
 RUN apt-get update && \
     apt-get install -y \
-      make \
       git \
+      make \
+      patch \
       software-properties-common
 
 RUN add-apt-repository ppa:deadsnakes/ppa && \
@@ -33,6 +34,9 @@ RUN make sync
 # generate a version.py module from git information
 RUN make generate-version
 
+WORKDIR /opt/atr/.venv/lib/python3.13/site-packages
+RUN patch -p2 < /opt/atr/patches/generics.py.patch
+
 # final image
 FROM ubuntu:24.04
 
diff --git a/Makefile b/Makefile
index 9ddc232..f91368b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
 .PHONY: build build-alpine build-playwright build-ts build-ubuntu certs \
   check check-extra check-light commit docs generate-version ipython \
-  run-playwright run-playwright-slow serve serve-local sync update-deps
+  run-playwright run-playwright-slow serve serve-local sync sync-all \
+  update-deps
 
 BIND ?= 127.0.0.1:8080
 IMAGE ?= tooling-trusted-release
@@ -81,6 +82,9 @@ serve-local:
 sync:
        uv sync --no-dev
 
+sync-all:
+       uv sync --all-groups
+
 update-deps:
        uv lock --upgrade
        uv sync --all-groups
diff --git a/patches/generics.py.patch b/patches/generics.py.patch
new file mode 100644
index 0000000..a6c3ad1
--- /dev/null
+++ b/patches/generics.py.patch
@@ -0,0 +1,31 @@
+diff --git a/src/asfquart/generics.py b/src/asfquart/generics.py
+index 452656d..361cdfc 100644
+--- a/src/asfquart/generics.py
++++ b/src/asfquart/generics.py
+@@ -3,6 +3,7 @@
+
+ import secrets
+ import urllib
++import urllib.parse
+ import time
+
+ import quart
+@@ -118,6 +119,17 @@ def enforce_login(app, redirect_uri=DEFAULT_OAUTH_URI):
+             and not quart.request.authorization
+             and not await asfquart.session.read()
+         ):
+-            return 
quart.redirect(f"{redirect_uri}?login={quart.request.full_path}")
++            # The werkzeug.sansio.request.full_path property returns:
++            # f"{self.path}?{self.query_string.decode()}"
++            # Therefore it contains a "?" even if there is no query string
++            full_path = quart.request.full_path
++            # Strip the trailing "?" when the query string is empty
++            if full_path.endswith("?"):
++                parsed = urllib.parse.urlsplit(full_path)
++                if not parsed.query:
++                    # The query string is empty
++                    full_path = full_path[:-1]
++            quoted_path = urllib.parse.quote(full_path)
++            return quart.redirect(f"{redirect_uri}?login={quoted_path}")
+         # If we have a session, but still no access, just say so in plain 
text.
+         return quart.Response(status=error.errorcode, response=error.message)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to