Skip to content

XPath multiple match returns one line instead multiple lines for URLs prefixed with "source:" #4477

Closed

Description

@ipaq3870

Symptom similar to issue #4302, for URLs prefixed with "source:", and with XPath matches more than one entries, all outputs are concatenated.

Version: 0.60.7
URL: source:https://www.wikipedia.org/
XPath: //link/@href

Current Output:

/static/apple-touch/wikipedia.png/static/favicon/wikipedia.ico//creativecommons.org/licenses/by-sa/4.0///upload.wikimedia.orghttps://wikis.world/@wikipedia

Expected Output:

/static/apple-touch/wikipedia.png
/static/favicon/wikipedia.ico
//creativecommons.org/licenses/by-sa/4.0/
//upload.wikimedia.org
https://wikis.world/@wikipedia

The following patch fixed the problem for me:

--- changedetection.io/changedetectionio/html_tools.py.0	2026-09-21 08:00:00.000000000 +0800
+++ changedetection.io/changedetectionio/html_tools.py	2026-09-23 10:54:45.309887407 +0800
@@ -418,6 +418,8 @@ def xpath_filter(xpath_filter, html_cont
             # Divs are converted to 4 whitespaces by inscriptis
             if append_pretty_line_formatting and len(html_block) and (not hasattr( element, 'tag' ) or not element.tag in (['br', 'hr', 'div', 'p'])):
                 html_block += TEXT_FILTER_LIST_LINE_SUFFIX
+            else:
+                html_block += "\n"

             if type(element) == str:
                 html_block += element

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions