Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange parsing of multistatus, namespaces not stripped #338

Open
Allam76 opened this issue Mar 14, 2023 · 1 comment
Open

strange parsing of multistatus, namespaces not stripped #338

Allam76 opened this issue Mar 14, 2023 · 1 comment

Comments

@Allam76
Copy link

Allam76 commented Mar 14, 2023

Hello and thank you for a great tool!
I have a legacy webdav server and the following strange multistatus parsing error occurs:

XML:

<?xml version="1.0" encoding="utf-8"?>
<A:multistatus xmlns:A="DAV:" xmlns:B="http://sap.com/kpro/xmlns">
<A:response><A:href>/sql_http_api/mime/SAP/PUBLIC/open_sql_rest_parser/</A:href>
<A:propstat><A:status>HTTP/1.1 200 OK</A:status><A:prop><B:CREATED_AT>20230314094415</B:CREATED_AT><B:CREATED_BY>DEVELOPER</B:CREATED_BY><B:DESCRIPTION>open sql rest parser</B:DESCRIPTION><B:FOLDER_ROLE/><B:KW_AUTHORIZATION/><B:KW_PARENT_FOLDER_CLASS>M_FOLDER</B:KW_PARENT_FOLDER_CLASS><B:KW_PARENT_FOLDER_ID>…                   1-</B:MIME_CACHE_EXPIRY><A:displayname>tests</A:displayname><A:resourcetype><A:collection/></A:resourcetype><A:getetag>080027E861FB1EEDB0C99A7B81858A5D</A:getetag><A:getcontentlength>0 </A:getcontentlength><A:getcontenttype>text/html; charset=utf-8</A:getcontenttype><A:creationdate>2023-03-14T09:44:36Z</A:creationdate><A:getlastmodified>Tue, 14 Mar 2023 09:44:36 GMT</A:getlastmodified>
<A:lockdiscovery/>
<A:supportedlock/>
</A:prop>
</A:propstat>
</A:response>
</A:multistatus>

However, JSON of the js response from fastxml is contains namespaces: (reduced for readability)

{
  "multistatus\nxmlns:A=\"DAV:\"\nxmlns:B=\"http://sap.com/kpro/xmlns\"": {
    "response": [
      {
        "href": "/sql_http_api/mime/SAP/PUBLIC/open_sql_rest_parser/",
        "propstat": {
     .......

source code clearly indicates that namespaces should be stripped:

        const result = xmlParser.parse(xml, {
            arrayMode: false,
            ignoreNameSpace: true
            // // We don't use the processors here as decoding is done manually
            // // later on - decoding early would break some path checks.
            // attrValueProcessor: val => decodeHTMLEntities(decodeURIComponent(val)),
            // tagValueProcessor: val => decodeHTMLEntities(decodeURIComponent(val))
        });

I'm unsure if this is a fastxml or webdav-client bug. Or possibly that I need to add some namespace definitions on the server side.

Many thanks!

@perry-mitchell
Copy link
Owner

Hi! Have you tried v5.2.0 of this library, if you're still having this issue? I understand it was some time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants