Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

list files: empty result and/or Sabre Exception #11

Open
wivaku opened this issue Jan 8, 2021 · 2 comments
Open

list files: empty result and/or Sabre Exception #11

wivaku opened this issue Jan 8, 2021 · 2 comments

Comments

@wivaku
Copy link

wivaku commented Jan 8, 2021

I have a webdav folder containing:

- <my webdav location>
  readme.md
  - testfolder
    readme.md

When listing files in root directory:

Storage::disk('webdav')->files() // Sabre\HTTP\ClientHttpException with message 'Method Not Allowed'
Storage::disk('webdav')->files('/') // Sabre\HTTP\ClientHttpException with message 'Method Not Allowed'

When listing specific file or folder I get an empty result:

Storage::disk('webdav')->files('Readme.md') // []
Storage::disk('webdav')->files('testfolder') // []
Storage::disk('webdav')->files('testfolder/') // []

Correct / expected behavior when listing non-existing file/folder:

Storage::disk('webdav')->files('doesnotexist') // correct: Sabre\HTTP\ClientHttpException with message 'Not Found'

Correct / expected behavior when using local filesystem:

Storage::disk('local')->files()
=> [
     ".gitignore",
   ]

(using WEBDAV_URI with trailing /, see #9)

Manual curl examples works fine:

curl -X PROPFIND --user "$WEBDAV_TOKEN:" "$WEBDAV_URI"
curl -X PROPFIND --user "$WEBDAV_TOKEN:" "$WEBDAV_URI/Readme.md"
curl -X PROPFIND --user "$WEBDAV_TOKEN:" "$WEBDAV_URI/testfolder"

e.g.

<?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>/public.php/webdav/testfolder/</d:href>
		<d:propstat>
			<d:prop>
				<d:getlastmodified>Fri, 08 Jan 2021 14:15:11 GMT</d:getlastmodified>
				<d:resourcetype>
					<d:collection/>
				</d:resourcetype>
				<d:quota-used-bytes>6</d:quota-used-bytes>
				<d:quota-available-bytes>-3</d:quota-available-bytes>
				<d:getetag>&quot;5f37wf868fehjekhef1cfh210&quot;</d:getetag>
			</d:prop>
			<d:status>HTTP/1.1 200 OK</d:status>
		</d:propstat>
	</d:response>
	<d:response>
		<d:href>/public.php/webdav/testfolder/Readme.md</d:href>
		<d:propstat>
			<d:prop>
				<d:getlastmodified>Fri, 08 Jan 2021 14:15:11 GMT</d:getlastmodified>
				<d:getcontentlength>6</d:getcontentlength>
				<d:resourcetype/>
				<d:getetag>&quot;ea8e2f6d3h2fjefeg87b54cb7998dd58da&quot;</d:getetag>
				<d:getcontenttype>text/markdown</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:multistatus>
@aguilerajl
Copy link

Hello, try this:

        'webdav' => [
            'driver'     => 'webdav',
            'baseUri'    => 'https://nextcloud.com/',
            'userName'   => 'UserXXX',
            'password'   => '******',
            'pathPrefix' => 'remote.php/dav/files/UserXXX/',
        ],

And then write
Storage::disk('webdav')->allFiles('/')

@wivaku
Copy link
Author

wivaku commented Jan 9, 2021

I see, so I have to split the path.
(in my case I am using shared folder, with token)

works:

        'webdav' => [
            'driver'     => 'webdav',
            'baseUri'    => 'https://mynextcloud.com/',
            'userName'   => 'tokenXXX',
            'pathPrefix' => 'public.php/webdav/',
        ],

works for get() and put() but not for files():

        'webdav' => [
            'driver'     => 'webdav',
            'baseUri'    => 'https://mynextcloud.com/public.php/webdav/',
            'userName'   => 'tokenXXX',
        ],

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

No branches or pull requests

2 participants