Core: Unexpected error creating public link in absence of "publicUpload" parameter

Created on 17 May 2017  路  14Comments  路  Source: owncloud/core

Steps to reproduce

  1. In sharing dashboard of admin web UI, disable Allow public uploads
  2. Client requests a new public link to a folder. (if the Allow public uploads capability is disabled in admin UI dashboard, in clients it is not displayed). The option is not included in the request, so it is optional:

screen shot 2017-05-17 at 17 14 25

Expected behaviour

New public link is created.

Current behaviour

Server returns an error:

screen shot 2017-05-17 at 16 59 03

Server configuration

Version 10.0.1RC1
This behaviour does not happen in 10.0.0

This curl command can be useful:

curl -k \
    -H 'Host:xxxxxx' \
    -H 'Content-Type:application/x-www-form-urlencoded' \
    -H 'Accept:*/*' \
    -H 'User-Agent:Mozilla/5.0 (iOS) ownCloud-iOS/3.5.3' \
     [...]
    -H 'Authorization:Basic YWRtaW46UGFzc3dvcmQ=' \
    -H 'OCS-APIREQUEST:true' \
    -X POST 'https://xxxxxxxxxxx/ocs/v1.php/apps/files_sharing/api/v1/shares' \
    --data-binary 'path=/Photos/&shareType=3&name=Photoslink'
Bug sharing regression sev2-high statuSTALE

All 14 comments

I can reproduce in the Desktop client. Can be fixed appending permissions=1 in the share request, in the same fashion the webUI does:

-X POST 'https://<server_url>/ocs/v1.php/apps/files_sharing/api/v1/shares' \ 
--data-binary 'path=/Photos&shareType=3&name=Photoslink&permissions=1'

But, of course, permission-handling should be transparent to clients.

I can reproduce in the Desktop client. Can be fixed appending permissions=1 in the share request.

That's not a proper solution, IMHO.

Both permissions and publicUploads are optional parameters. A POST request not including them should default to a new resource with valid values for them, not to a version that is forbidden by the current server configuration.

cc @PVince81 @felixheidecke

Ok that's a bug. I fixed an issue recently there and remember the code is supposed to default to 1 if no "permissions" is set. I'll have a look...

Wrote two integration tests, could not reproduce the issue... permissions default to 1 on master.

Will try with curl...

on master:

% curl -u admin:admin -H 'Content-Type:application/x-www-form-urlencoded' -H 'OCS-APIREQUEST:true' -X POST 'http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares' --data-binary 'path=/welcome.txt&shareType=3&name=Photoslink'

I get a proper XML response.

Now let's check 10.0.1RC1...

ah, oh course... it needs to be a folder, not a file... retrying...

If you give more than 1 for permissions on create is not allowed (well ignored), we need the publicUpload to give more permissions

It needs to work the same like it did in 9.1

ok, then maybe it's the files_drop bit that changed behavior slightly...

this commit: b621ea2d2d9e2d7470e8d5fc7bcd22ef08276bb5

I'll try and fix this...

seems it was a wrongly written condition, PR here https://github.com/owncloud/core/pull/27927 please review

Reviewed:

  • [X] iOS
  • [X] Android

any check related with desktop client @SamuAlfageme?

@PVince81

LGTM 馃憤

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings