From 0681a5c86a376c85139770e31e259ba483af76c5 Mon Sep 17 00:00:00 2001 From: Koopa Date: Wed, 1 Dec 2021 02:15:05 -0500 Subject: [PATCH] lib/rest: process HTML entities within XML MEGAcmd currently includes escaped HTML4 entites in its XML messages. This behavior deviates from the XML standard, but currently it prevents rclone from being able to use the remote. --- lib/rest/rest.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rest/rest.go b/lib/rest/rest.go index e534b0d1e..316b9a77f 100644 --- a/lib/rest/rest.go +++ b/lib/rest/rest.go @@ -167,6 +167,10 @@ func DecodeJSON(resp *http.Response, result interface{}) (err error) { func DecodeXML(resp *http.Response, result interface{}) (err error) { defer fs.CheckClose(resp.Body, &err) decoder := xml.NewDecoder(resp.Body) + // MEGAcmd has included escaped HTML entities in its XML output, so we have to be able to + // decode them. + decoder.Strict = false + decoder.Entity = xml.HTMLEntity return decoder.Decode(result) }