]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: include BASE_URL when constructing `doc_url` for workflows (#11360)
authorEd Bardsley <ebardsley@gmail.com>
Fri, 14 Nov 2025 17:45:13 +0000 (09:45 -0800)
committerGitHub <noreply@github.com>
Fri, 14 Nov 2025 17:45:13 +0000 (17:45 +0000)
---------

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
src/documents/signals/handlers.py
src/documents/tests/test_workflows.py

index a7641ecf2907b797d12126f1d380f2c5fd926b6e..738ecb0864acdda4b18a2fc2629b483d008e1c9e 100644 (file)
@@ -1095,7 +1095,9 @@ def run_workflows(
 
         if not use_overrides:
             title = document.title
-            doc_url = f"{settings.PAPERLESS_URL}/documents/{document.pk}/"
+            doc_url = (
+                f"{settings.PAPERLESS_URL}{settings.BASE_URL}documents/{document.pk}/"
+            )
             correspondent = (
                 document.correspondent.name if document.correspondent else ""
             )
@@ -1212,7 +1214,9 @@ def run_workflows(
     def webhook_action():
         if not use_overrides:
             title = document.title
-            doc_url = f"{settings.PAPERLESS_URL}/documents/{document.pk}/"
+            doc_url = (
+                f"{settings.PAPERLESS_URL}{settings.BASE_URL}documents/{document.pk}/"
+            )
             correspondent = (
                 document.correspondent.name if document.correspondent else ""
             )
index a2a5aa9c3380c65774dd52b9dd66fcd9bccac175..6438e4b100ffe40c73b1c716e9040195a4ba9b2b 100644 (file)
@@ -3212,6 +3212,8 @@ class TestWorkflows(
 
     @override_settings(
         PAPERLESS_URL="http://localhost:8000",
+        PAPERLESS_FORCE_SCRIPT_NAME="/paperless",
+        BASE_URL="/paperless/",
     )
     @mock.patch("documents.signals.handlers.send_webhook.delay")
     def test_workflow_webhook_action_body(self, mock_post):
@@ -3263,7 +3265,7 @@ class TestWorkflows(
 
         mock_post.assert_called_once_with(
             url="http://paperless-ngx.com",
-            data=f"Test message: http://localhost:8000/documents/{doc.id}/",
+            data=f"Test message: http://localhost:8000/paperless/documents/{doc.id}/",
             headers={},
             files=None,
             as_json=False,