From 83cbb59c722dc91f4fa01df46c8b89a9957ed302 Mon Sep 17 00:00:00 2001 From: Ed Wilde Date: Thu, 17 Oct 2024 12:04:03 +1300 Subject: [PATCH] FIX Apply the same fix to other usage of `absoluteURL()` --- src/DataFormatter/XMLDataFormatter.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/DataFormatter/XMLDataFormatter.php b/src/DataFormatter/XMLDataFormatter.php index 5b8c559..db91c34 100644 --- a/src/DataFormatter/XMLDataFormatter.php +++ b/src/DataFormatter/XMLDataFormatter.php @@ -160,11 +160,11 @@ class XMLDataFormatter extends DataFormatter $fieldName = $relName . 'ID'; if ($obj->$fieldName) { - $href = Director::absoluteURL($this->config()->api_base . "$relClass/" . $obj->$fieldName); + $href = Director::absoluteURL($this->config()->api_base . "$relClass/" . $obj->$fieldName . ".xml"); } else { - $href = Director::absoluteURL($this->config()->api_base . "$className/$id/$relName"); + $href = Director::absoluteURL($this->config()->api_base . "$className/$id/$relName" . ".xml"); } - $xml .= "<$relName linktype=\"has_one\" href=\"$href.xml\" id=\"" . $obj->$fieldName + $xml .= "<$relName linktype=\"has_one\" href=\"$href\" id=\"" . $obj->$fieldName . "\">\n"; } @@ -190,8 +190,8 @@ class XMLDataFormatter extends DataFormatter $items = $obj->$relName(); if ($items) { foreach ($items as $item) { - $href = Director::absoluteURL($this->config()->api_base . "$relClass/$item->ID"); - $xml .= "<$relClass href=\"$href.xml\" id=\"{$item->ID}\">\n"; + $href = Director::absoluteURL($this->config()->api_base . "$relClass/$item->ID" . ".xml"); + $xml .= "<$relClass href=\"$href\" id=\"{$item->ID}\">\n"; } } $xml .= "\n"; @@ -221,8 +221,8 @@ class XMLDataFormatter extends DataFormatter $items = $obj->$relName(); if ($items) { foreach ($items as $item) { - $href = Director::absoluteURL($this->config()->api_base . "$relClass/$item->ID"); - $xml .= "<$relClass href=\"$href.xml\" id=\"{$item->ID}\">\n"; + $href = Director::absoluteURL($this->config()->api_base . "$relClass/$item->ID" . ".xml"); + $xml .= "<$relClass href=\"$href\" id=\"{$item->ID}\">\n"; } } $xml .= "\n";