buttercup / buttercup-browser-extension

:earth_asia: Buttercup browser extension
https://buttercup.pw
MIT License
235 stars 42 forks source link

WebDAV failed to connect: t is undefined #332

Closed tuaris closed 4 years ago

tuaris commented 4 years ago

Using extension version 2.14.0.

I'm aware of #282 and #174 but neither of those appear to be the issue I'm observing. I've tested this with my own personal Owncloud instance and the one over at demo.nextcloud.com. From my understanding, both Owncloud and Nextcloud use https://sabre.io/ for webdav implementation.

To reproduce:

Here's what the Firefox console shows:

[info] Creating WebDAV connection to: https://demo2.nextcloud.com/remote.php/webdav
[info] Testing WebDAV connection...
[XHR] PROPFIND https://demo2.nextcloud.com/remote.php/webdav/
[error] WebDAV failed to connect: t is undefined
[error] Failed establishing WebDAV connection: https://demo2.nextcloud.com/remote.php/webdav

This is the response payload from the server

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/webdav/</d:href><d:propstat><d:prop><d:getlastmodified>Sat, 14 Mar 2020 04:45:00 GMT</d:getlastmodified><d:resourcetype><d:collection/></d:resourcetype><d:quota-used-bytes>0</d:quota-used-bytes><d:quota-available-bytes>-3</d:quota-available-bytes><d:getetag>&quot;5e6c614c56ddb&quot;</d:getetag></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response><d:response><d:href>/remote.php/webdav/Documents/</d:href><d:propstat><d:prop><d:getlastmodified>Sat, 14 Mar 2020 04:45:01 GMT</d:getlastmodified><d:resourcetype><d:collection/></d:resourcetype><d:quota-used-bytes>405265</d:quota-used-bytes><d:quota-available-bytes>-3</d:quota-available-bytes><d:getetag>&quot;5e6c614d749c4&quot;</d:getetag></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontentlength/><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/webdav/Nextcloud%20Manual.pdf</d:href><d:propstat><d:prop><d:getlastmodified>Sat, 14 Mar 2020 04:45:01 GMT</d:getlastmodified><d:getcontentlength>6838469</d:getcontentlength><d:resourcetype/><d:getetag>&quot;0dfffd3eb847af31d0b1403bc02e59e3&quot;</d:getetag><d:getcontenttype>application/pdf</d:getcontenttype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:quota-used-bytes/><d:quota-available-bytes/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/webdav/Nextcloud%20intro.mp4</d:href><d:propstat><d:prop><d:getlastmodified>Sat, 14 Mar 2020 04:45:00 GMT</d:getlastmodified><d:getcontentlength>3963036</d:getcontentlength><d:resourcetype/><d:getetag>&quot;bf539a121cc3434ddaebbdfbc8a5ee73&quot;</d:getetag><d:getcontenttype>video/mp4</d:getcontenttype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:quota-used-bytes/><d:quota-available-bytes/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/webdav/Nextcloud.png</d:href><d:propstat><d:prop><d:getlastmodified>Sat, 14 Mar 2020 04:45:01 GMT</d:getlastmodified><d:getcontentlength>50598</d:getcontentlength><d:resourcetype/><d:getetag>&quot;e94660fcdf709387283882e9496119b9&quot;</d:getetag><d:getcontenttype>image/png</d:getcontenttype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:quota-used-bytes/><d:quota-available-bytes/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/webdav/Photos/</d:href><d:propstat><d:prop><d:getlastmodified>Sat, 14 Mar 2020 04:45:01 GMT</d:getlastmodified><d:resourcetype><d:collection/></d:resourcetype><d:quota-used-bytes>5656463</d:quota-used-bytes><d:quota-available-bytes>-3</d:quota-available-bytes><d:getetag>&quot;5e6c614d0e62d&quot;</d:getetag></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontentlength/><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>

On the server side the logs show (obviously from my personal instance):

192.168.0.x - myuser [14/Mar/2020:00:39:59 -0400] "PROPFIND /remote.php/webdav/ HTTP/1.1" 207 546
tuaris commented 4 years ago

Just for fun I setup a simple WebDAV server using Apache

<VirtualHost *:80>
    DocumentRoot /var/ftp/incoming/WebDAV
    ServerName webdav.my.domain

    DAVMinTimeout 600
    DAVLockDB /var/spool/webdav/DAVLock

    <Location />
        DAV on
    </Location>
</VirtualHost>

The result is the same but the error is slightly different:

[error] WebDAV failed to connect: t.multistatus.response.filter is not a function

I can confirm that WebDAV is working using WinSCP as a client to upload and download files. (for both this test server and Owncloud)

perry-mitchell commented 4 years ago

Hmm, I don't get any failures on Chrome/Firefox for webdav vaults - either adding new or unlocking anold one. Mind you I'm not testing on Nextcloud at the moment. I'll try on Nextcloud next.

perry-mitchell commented 4 years ago

I can't even seem to get authenticated with Nextcloud:

image

I'm testing on Yandex's WebDAV which works fine. My OwnCloud as well. I won't rule out that there's some bug in the webdav handling, but I suspect that there's some other issue going on with the response you're seeing in both of your cases.

t.multistatus.response.filter seems like the WebDAV response you got was invalid or of a structure that I'm not familiar with (as I'm the author of the webdav library we're using). If you could share any of your PROPFIND responses, that might help.

julianpoemp commented 4 years ago

I get also a connection error with my owncloud, but the error messages are different: #336

perry-mitchell commented 4 years ago

@tuaris Still seeing this issue?

perry-mitchell commented 4 years ago

I'm going to close this issue, for now - We don't openly support Nextcloud or ownCloud, as they're (by default) configured incorrectly for "true" WebDAV access (in that it has CORS issues when accessed from the web via Buttercup scripts). There's no way around this from our side, and requires that either ownCloud fix the issue (and Nextcloud downstream), or that the server owner implements a hack (as I've done on my ownCloud).

Due to this, I'll close this as WebDAV works fine with services that provide a valid WebDAV interface (Yandex). If we see this more broadly, I'll happily reopen.