From 1f784f2b87ed0b2fd478e46d0d292c33f3150a3b Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 13 Nov 2026 20:13:54 +0100 Subject: fix(core): clarify Huey file path semantics Document and test SQLAlchemy-style slash handling for file and SQLite Huey URLs, including distinct relative and absolute path forms. Update validation errors to show the supported three- and four-slash conventions. --- webmentions_ssg/tasks/extension.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'webmentions_ssg/tasks') diff --git a/webmentions_ssg/tasks/extension.py b/webmentions_ssg/tasks/extension.py index 029de68..2e78cc0 100644 --- a/webmentions_ssg/tasks/extension.py +++ b/webmentions_ssg/tasks/extension.py @@ -204,7 +204,9 @@ class Huey: def backend_from_url(url: str) -> tuple[type[BaseHuey], dict[str, Any]]: """Determine the Huey backend and storage options from a URL. - :param url: Huey backend URL. + :param url: Huey backend URL. SQLite and file paths use SQLAlchemy's + slash convention: three slashes for relative paths and four for + absolute paths (not RFC 8089 file-URI semantics). :return: Huey backend class and keyword arguments for its storage backend. :raises RuntimeError: If the URL is malformed for the selected backend or uses an unsupported scheme. @@ -240,9 +242,11 @@ class Huey: if not url.startswith(prefix): raise RuntimeError( - "SQLite Huey URLs must look like sqlite:///var/huey.db" + "SQLite Huey URLs must look like sqlite:///huey.db (relative) " + "or sqlite:////var/huey.db (absolute)" ) + # Preserve a leading slash only when the URL has four slashes. filename = url.removeprefix(prefix) if not filename: @@ -257,9 +261,11 @@ class Huey: if not url.startswith(prefix): raise RuntimeError( - "File Huey URLs must look like file:///var/huey-queue" + "File Huey URLs must look like file:///huey-queue (relative) " + "or file:////var/huey-queue (absolute)" ) + # file:////path is absolute; file:///path is relative here. path = url.removeprefix(prefix) if not path: -- cgit v1.3.1