Skip to content

CardDAV addressbook-multiget report does not create href urls correctly from the xml request body #1630

@shubhra-prakash-nandi

Description

@shubhra-prakash-nandi

If I send the below addressbook-multiget report request to a differently formed (notice // after hostname) URL - http://hostname//addressbooks/principal/something/ the hrefs in the request are not formed correctly. They are formed something like //addressbooks/addressbooks/principal/something/uri1.vcf

<card:addressbook-multiget xmlns:d="DAV:" xmlns:card="urn:ietf:params:xml:ns:carddav">
    <d:prop>
        <d:getetag />
        <card:address-data />
    </d:prop>
    <d:href>/addressbooks/principal/something/uri1.vcf</d:href>
    <d:href>/addressbooks/principal/something/uri2.vcf</d:href>
</card:addressbook-multiget>

I am providing the patch for this below. Please check and incorporate as needed.

--- commit-bc0b0ada27a3653e9955381abd6f1334b874dc06/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php	2026-03-18 15:46:22.186973946 +0530
+++ patch/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php	2026-03-18 15:50:46.019104219 +0530
@@ -101,7 +101,7 @@
                     }
                     break;
                 case '{DAV:}href':
-                    $newProps['hrefs'][] = Uri\resolve($reader->contextUri, $elem['value']);
+                    $newProps['hrefs'][] = Uri\resolve(preg_replace('|/+|', '/', $reader->contextUri), $elem['value']);
                     break;
             }
         }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions