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

error when using WebDAV w/ Nextcloud (read+write) #9

Closed
wivaku opened this issue Nov 20, 2020 · 8 comments
Closed

error when using WebDAV w/ Nextcloud (read+write) #9

wivaku opened this issue Nov 20, 2020 · 8 comments

Comments

@wivaku
Copy link

wivaku commented Nov 20, 2020

I have setup a Nextcloud shared folder (upload + edit permissions), which can be accessed using WebDAV.
But when connecting through Laravel I get errors.

My config:

        'webdav' => [
            'driver'     => 'webdav',
            'baseUri'    => env('WEBDAV_URI'),
            'userName'   => env('WEBDAV_TOKEN'), // no password is used, but same result when I do enable+add one
        ],

Works fine with curl

echo "hello" > /var/tmp/tempfile.txt; curl -T /var/tmp/tempfile.txt --user "$WEBDAV_TOKEN:" $WEBDAV_URI/tempfile.txt
curl --user "$WEBDAV_TOKEN:" $WEBDAV_URI/tempfile.txt
hello

When using Tinker I get error messages:

Storage::disk('webdav')->get('tempfile.txt')
Illuminate/Contracts/Filesystem/FileNotFoundException with message 'File not found at path: tempfile.txt'

Storage::disk('webdav')->put('testupload.txt', 'test123')
false

When I use an incorrect WEBDAV_TOKEN, curl gives authentication error message, Tinker gives the same result (no authentication error message).

@Scumi
Copy link

Scumi commented Nov 26, 2020

Works for me. Maybe a permission issue?

@wivaku
Copy link
Author

wivaku commented Nov 26, 2020

What could the permission issue be?
I would think the curl example would then be affected by that same permission issue?
Is there a way to debug?

@Scumi
Copy link

Scumi commented Nov 26, 2020

Right, when curl works it shouldn't be permissions.

Can you post your webdav-filesystem config values? See mine below.

'nextcloud' => [
    'driver'     => 'webdav',
    'baseUri'    => config('cloud.url') . 'remote.php/dav/files/user/',
    'userName'   => config('cloud.admin_user'),
    'password'   => config('cloud.admin_password'),
    'pathPrefix' => '', // optional
],

I started using this today and apart from some small (already reported) bugs in the flysystem-webdav adapter, it works fine.

@wivaku
Copy link
Author

wivaku commented Nov 27, 2020

for my config: see original post.

I am using the share link (token based) webdav.
https://docs.nextcloud.com/server/latest/user_manual/en/files/access_webdav.html#accessing-public-shares-over-webdav

Not sure if it is Nextcloud related, have not tried other Webdav sources (yet).

@pascalbaljet
Copy link
Contributor

I've used https://your-nextcloud.com/remote.php/webdav/ in previous projects.

The Flysystem WebDAV adapter uses sabre/dav under the hood.

@wivaku
Copy link
Author

wivaku commented Nov 27, 2020

That sounds promising Pascal. I am indeed using https://mynextcloud.com/public.php/webdav.
You've also used the shared link with token (with or without password)?
Suggestions what is causing it not to work in my case?

@aguilerajl
Copy link

Hello, i think you need a slash at the end:
https://mynextcloud.com/public.php/webdav/ <= works
https://mynextcloud.com/public.php/webdav <= doesn't work

@wivaku
Copy link
Author

wivaku commented Jan 8, 2021

that was indeed it. Thanks!
The fact that curl worked fine made me believe the URI was not causing a problem.

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

4 participants