meganz / sdk

MEGA C++ SDK
BSD 2-Clause "Simplified" License
1.33k stars 504 forks source link

HTML4 entities don't work with all WebDAV clients #2599

Open CodingKoopa opened 2 years ago

CodingKoopa commented 2 years ago

Pull request #1250 changed the WebDAV server to have it escape all HTML4 entities, but some of them seem to cause issues for certain WebDAV clients.

Reproduction

When listing the directory with cadaver, the following error occurs:

XML parse error at line 56: undefined entity

When listing the directory with rclone, with the command rclone lsi mega-webdav: (where mega-webdav is the name I gave to the remote), the following error occurs:

error listing: couldn't list files: XML syntax error on line 56: invalid character entity &add;

Solution

Indeed, if we look at the source code for cadaver, we see that it uses the Expat XML parser, which does not appear to implement the HTML4 entities. It does, however, support specifying characters by number. Thus, I was able to make it work with cadaver and rclone like so:

src/utils.cpp

-        escapesec[43] = "&add;"; // +
+        escapesec[43] = "+"; // +