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

Nextcloud 18: Impossible to share files from external file storage #19265

Closed
ppattard opened this issue Feb 3, 2020 · 37 comments
Closed

Nextcloud 18: Impossible to share files from external file storage #19265

ppattard opened this issue Feb 3, 2020 · 37 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: sharing

Comments

@ppattard
Copy link

ppattard commented Feb 3, 2020

Hello,

I did the upgrade yesterday to NextCloud 18. Since then, I am no longer able to share files with other (internal) users. I get an error popup when I try and noticed an error 404 in the browser for URL /ocs/v2.php/apps/files_sharing/api/v1/shares . There is no log on the server side.

Note: I have file_sharing 1.10.1 installed.
Note 2: already shared files are still working fine.

Would you be able to help ? I can provide more details if you let me know what you need to reproduce.

Thank you.

@kesselb kesselb added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug 18-feedback labels Feb 3, 2020
@chribre
Copy link

chribre commented Feb 3, 2020

Hello,
same here but if you reload the page there's a log "shared with user" on activities and in my case it then is shared.

@ppattard
Copy link
Author

ppattard commented Feb 3, 2020

Not in my case: no activity log and folder still not shared :(

@Schmuuu
Copy link

Schmuuu commented Feb 3, 2020

Hello,

I also reported this issue. Unfortunately it was moved over to the nextcloud/maps repo :(
nextcloud/maps#286

I would like to warn you to play around with shares right now. I also noticed that I still had my old shares, but to collect some debug data I created new shares and unshared them and during that time I lost all my old shares.
So I don't know what action exactly deleted all the shares (DB table is empty) and it might have been the "unsharing". Just to be safe, better don't do it, until the issue is fixed.

@kesselb
Copy link
Contributor

kesselb commented Feb 3, 2020

@Schmuuu #19248

@Schmuuu
Copy link

Schmuuu commented Feb 3, 2020

Awesome, you are great @kesselb !
Thanks a lot for linking me to that issue and the fix.

@ ppattard, turned out it is really the maps app, causing the issue, that sharing files doesn't work. I just disabled the maps app and sharing works again.
A fixed version is on the way.

And as kesselb is linking to the other case, that is the issue causing my shares to get deleted. So, there is a fix as well.

@ppattard
Copy link
Author

ppattard commented Feb 3, 2020

@Schmuuu thanks for pointing to your ticket! I have checked what is explained and to be honest I'm not convinced since in my case I don't even have the Maps app installed... So could be something similar with another app I suppose, but which one then ?

@Schmuuu
Copy link

Schmuuu commented Feb 3, 2020

@ppattard oh, good question then. The devs found out about the maps app as issue for me by the nextcloud.log. Maybe you can share your logfile as well and they can find out.

For me the issue is really solved by just disabling Maps.

@ppattard
Copy link
Author

ppattard commented Feb 3, 2020

Actually I found that sharing works on all folders BUT on external file storage folders (which is what I was trying to share since the beginning). Still trying to figure out if I can narrow down the problem. So clearly another problem than the maps one, and this one is linked to external file storage.

@ppattard ppattard changed the title Nextcloud 18: Impossible to share files Nextcloud 18: Impossible to share files from external file storage Feb 3, 2020
@ppattard
Copy link
Author

ppattard commented Feb 3, 2020

For the record:

  • using External Storage Support 1.9.0
  • using "Local" storage type on a folder where the webserver has read only access
  • have ticked the "Can share" box in the settings
  • I have tried to create a new local share and same problem occurs
  • The public link share works, only the share with other internal user or group does not

@ppattard
Copy link
Author

Hello,

Any news concerning my issue ? How can I help ? I've tried to set the logs in debug mode but either I failed or there is really nothing printed.

Thx.

@ppattard
Copy link
Author

Have the same issues. Had to disable maps to still be able to share data with other contacts. =(

Edit: A few minutes ago I was able to update to maps 0.1.5. The bug seems to be gone.

Again, this ticket is NOT about the issue with maps. There is another ticket for that already. This ticket is about sharing files stored on external storage not working (even if maps plugin not activated of course)

@ghost
Copy link

ghost commented Feb 20, 2020

Calm down, I will no longer publish a workaround or feedback.

@ManOki
Copy link

ManOki commented Feb 25, 2020

I'm having probably the same issue. I do not have maps app installed, I'm on NC 18.0.1, External storage support 1.9.0 and File sharing 1.10.1.

I'm able to add shares for regular internal folders, but not for external, in my case a SMB share.

EDIT: I even tested NC Android App 3.10.1 as client. There is no error shown, but the share is also not created.

EDIT2: I tested another type than SMB and Local: an external Nextcloud share works fine, I can share subfolders to other users.

EDIT3: I tested SFTP, sharing does also NOT work like SMB or Local.

@ppattard
Copy link
Author

ppattard commented Feb 29, 2020

@ManOki did you manage to get logs ? I've tried to set loglevel to 0 but there is absolutely nothing shown, as if I had not changed anything. I tried to change the logfile and it works, but no debug log. All I can see is this 404 Error in the browser console.

EDIT: I have just found in the doc it is possible to add "debug: true". After that, I have much more logs but still nothing interesting, and apparently nothing really triggerd on the action... mostly a repeated message about "Application is not setup via query()".

@ManOki
Copy link

ManOki commented Mar 2, 2020

No, I don't see any logs on the server, but i also managed to see 404 like you mentioned:

xhr.js:178 POST https://nextcloud.mydomain.com/nextcloud/ocs/v2.php/apps/files_sharing/api/v1/shares 404
ShareRequests.js:61 Error while creating share Error: Request failed with status code 404
    at t.exports (createError.js:16)
    at t.exports (settle.js:17)
    at XMLHttpRequest.d.onreadystatechange (xhr.js:61)

There are also two warnings before (I don't know, if they are related)

showDetailsView is deprecated! Use OCA.Files.Sidebar.activeTab. It will be removed in nextcloud 20.
globals.js:66 The escapeHTML library is deprecated! It will be removed in nextcloud 19.

@ManOki
Copy link

ManOki commented Mar 3, 2020

I debugged javascript and found the corresponding request.

With curl and the following command, I'm able to reproduce the error on command line:

curl -u "username:password" -X POST --header "OCS-APIRequest: true" https://nextcloud.mydomain.com/nextcloud/ocs/v2.php/apps/files_sharing/api/v1/shares -d path="/myshare" -d shareType=0 -d shareWith=otherusername

The server response is:

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>failure</status>
  <statuscode>404</statuscode>
  <message>Kann die Berechtigungen von /username/files/myshare nicht erhöhen</message>
 </meta>
 <data/>
</ocs>

The message is German, translated "Can't increase permissions of /username/files/myshare".

Offtopic: The statuscode is a bit confusing as it could be misinterpreted as HTTP code 404 (File not found, a client error), but this time the server is responding an error message (which should be a HTTP code 500+ for server errors).

EDIT: Just for clarification, I can share regular directories to other users with the curl command.

@ppattard
Copy link
Author

ppattard commented Mar 5, 2020

Good catch. I checked the server code, the error is thrown here:

        // Check that we do not share with more permissions than we have
        if ($share->getPermissions() & ~$permissions) {
            $message_t = $this->l->t('Can’t increase permissions of %s', [$share->getNode()->getPath()]);
            throw new GenericShareException($message_t, $message_t, 404);
        }

I added a debug log and I can see that
$share->getPermissions() = 31 = READ | UPDATE | CREATE | DELETE | SHARE
but
$permissions (which is = $share->getNode()->getPermissions() | DELETE | UPDATE) = 27 = READ | UPDATE | DELETE | SHARE.

So indeed the AND condition fails because the permission CREATE is missing.

I don't know at all what this means since I don't know the code of Nextcloud at all.

All I can say for now to precise the case is that:

  • the physical folder is not writeable by the webserver in my case, and it is even owned by a different user than the server's user. I tried to chown it but it does not help.
  • the share I have declared in nextcloud is declared as read-only. I tried to change that but it does not help either.

The lines in question have apparently been changed in July via this commit: 85a80b0 from @nickvergessen Don't know if it is related (probably not since it is merged since 17.0.0)...

@systemofapwne
Copy link

Is there any news about this? I just ran into the same issue.

NextCloud: 18.0.3
External Storage: 1.9.0
File Sharing: 1.10.1

The external storage I want to share is a SMB share, mounted on my host as read only with 555. That external storage is then added as "Local" to NextCloud.

@stjosh
Copy link

stjosh commented Apr 2, 2020

Same issue here. Would be great to get an update on this...

@cdammanintopix
Copy link
Contributor

cdammanintopix commented Apr 7, 2020

Same issue here. My external storage is then added as "Local" to NextCloud.

NextCloud: 18.0.3
External Storage: 1.9.0
File Sharing: 1.10.1

The error is:

Error loading the shares list Error: Request failed with status code 404
    at t.exports (createError.js:16)
    at t.exports (settle.js:17)
    at XMLHttpRequest.d.onreadystatechange (xhr.js:61)

The returned message is:

{"ocs":{"meta":{"status":"failure","statuscode":404,"message":"Wrong path, file\/folder doesn't exist"},"data":[]}}

@cdammanintopix
Copy link
Contributor

cdammanintopix commented Apr 8, 2020

I found the issue in my case: the external local storage was added using a relative path that made the file_exists function in lib/private/Files/Storage/Local.php (at line 231) fail, because it was called with an incorrect relative path. Modifying the relative path to an absolute path in the GUI fixed the issue.

@ppattard @systemofapwne @stjosh does this works for you too?

@systemofapwne
Copy link

systemofapwne commented Apr 8, 2020

Thank you for the reply.
Unfortunately, I already use absolute paths.

On my VM, I mounted my NAS in /mnt/nas. That location on the otherhand is then overlayed via docker to the container, where I am running nextcloud in it. Here, the mount point is simply /nas. In the nextcloud gui, I have set that path (/nas). Yet, direct sharing to other people does not work (sharing via a link on the otherhand still works).

@stjosh
Copy link

stjosh commented Apr 8, 2020

@ppattard @systemofapwne @stjosh does this works for you too?

Thanks, however, the error message you describe and the one which is originally described in this issue is differing quite a bit (see @ManOki 's comment above)

@ppattard
Copy link
Author

@stjosh Nope, still not working for me. I'm using an absolute path as well and still not working despite the recent updates. I still believe the issue is related to permissions as commenting the code mentioned above makes it work (at the price of losing all security...).

@Sursur123
Copy link

Sursur123 commented Apr 20, 2020

Same problem for me :(
When I try to share an external folder, an error message appears and the folder is not shared. No log entry is generated.
Seems to be broken since one oder two versions ago, because it worked some time ago...

EDIT: Same error in 18.0.4

@Sursur123
Copy link

Sursur123 commented May 25, 2020

Push, still cannot share external folders...
Please let me know if I can help somehow.

EDIT: Installed 19.0.0 RC3. Same error.

@codingHahn
Copy link

@ppattard where did you find $permissions (which is = $share->getNode()->getPermissions() | DELETE | UPDATE) = 27 = READ | UPDATE | DELETE | SHARE in the code? I can't find it. Or is it debug output?

@olivierchami
Copy link

Hi,
Same problem here, with release 19.0.0. Nothing on log.
Ready for tests if needed.
Thank you.

@ppattard
Copy link
Author

ppattard commented Jun 6, 2020

@ppattard where did you find $permissions (which is = $share->getNode()->getPermissions() | DELETE | UPDATE) = 27 = READ | UPDATE | DELETE | SHARE in the code? I can't find it. Or is it debug output?

@codingHahn Just a few lines before the line I mentioned there is the assignment of $permissions (it is inside an if...else and I tested that it ends up in the else). For the values, yes I added some extra debug logs to find it.

@MikeK123
Copy link

Thank you @cdammanintopix !!!
I'm using nextcloud 19.0.0 in docker container and some "local" external storage, which is a NFS share on host. I was able to create/copy files/folders onto that storage, but not able to move/share with "not writable" and "unable to load share..." error messages.
The defined local share had a green flag.
I mounted the volume in docker-compose:
"/mnt/nas/nextcloud:/var/www/html/nas"
and in nextcloud external storage configuration with simple location relative path "nas".
Once I changed the location to absolute path to:
"/var/www/html/nas"
Evyrything started to work as it should!

@philippjess
Copy link

philippjess commented Jul 14, 2020

I am mounting a local path with External Storage and have exactly the same problem IF i check the "Read Only" Box in the external storage settings. If i mount them writable, sharing with other users works. I can then revoke write permission from them, so this is a workaround for me. Time to set default share permissions to READ only i guess. This is on Version 19.0.0 .

@systemofapwne
Copy link

Very good findings. I was able to reproduce this behavior. This is a bit annoying though, but works for me right now: I am anyway mounting a read-only FS right now, but want to switch to RW at some point. I hope this bug gets fixed in the near future

@svankan
Copy link

svankan commented Jul 18, 2020

Same problem for me :(
When I try to share an external folder, an error message appears and the folder is not shared. No log entry is generated.
Seems to be broken since one oder two versions ago, because it worked some time ago...

EDIT: Same error in 18.0.4

My share problem was solved after upgrading Nextcloud from 18.0.6 to 18.0.7.

@codingHahn
Copy link

Solved for me as well after the update to 18.0.7

@systemofapwne
Copy link

Updating to docker/nextcloud:latest (seems to be 19.0.1) fixed it for me too: I can share external storage with ro. Fantastic!

@ManOki
Copy link

ManOki commented Jul 21, 2020

It does work for me with NC19.0.1, too.

But there is still a problem, if the external share is offline. If the original sharer does not log into NC after the share is gone offline, the user, who received the share does not even see his own files. see #16880

@ppattard
Copy link
Author

I confirm, version 19.0.1 fixes the issue. Hence closing the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: sharing
Projects
None yet
Development

No branches or pull requests