-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Can't share with user that only has numbers as name #37324
Comments
Confirmed - using current core master and PHP dev server and PHP 7.4 I tried to share from user
|
Here is a
And it works fine if the shareWith user
|
Q1) what happened in 10.4.0 that the way the request is done from the UI changed from from-data to JSON? Q2) when sending a JSON payload, like in the |
Looks like the below commit changes in the ajax call for OCS createShare api led to this problem:
core/lib/private/Share20/Share.php Lines 245 to 246 in 016b7fa
Share object has argument type validations on its setter methods like given in above. We can catch InvalidArgumentExceptions and return HTTP 400 (Bad request) instead of 500. |
Actually why do we care so much that it is string. If it is a "number" that can be cast to a string and ends up as a valid UID then all is good - e.g. Tricky cases will be UIDs like "+1" which might be sent as just the integer |
Fails with UIDs: Works with UIDs: Failure seems to be only with UIDs that look like a "small enough" integer (positive or negative). In that case the Other things that look like numbers are OK because the UI puts quotes around them when sending the JSON payload. Groups seem OK - I tried a group called
|
@karakayasemi something like #37327 fixes it. |
@phil-davis #37327 can fix int sharedWith in json payload case and the current web UI regression. However, some api requests like below will continue to fail:
In this case, we are correcting integer parameter problems, but we are not correcting any other primitive type like double problems. IMHO, interface method signature is correct, |
Sending without quotes is very tricky for UIDs that look like
By the time the value Would have to look earlier where the JSON is received on the server and decoded to see if the |
Looks like the main cause of the problem is the server returns share autocomplete list uid's as integer if uid is in numeric format due to following described behavior of the php: https://stackoverflow.com/questions/4100488/a-numeric-string-as-array-key-in-php I created a fix draft pr #37336 to see if newly added acceptance tests pass. |
Steps to reproduce
Expected behaviour
The file should get shared with the user.
Actual behaviour
The "popup" comes back again and the file won't get shared. A 500 error comes back from /ocs/v2.php/apps/files_sharing/api/v1/shares?format=json. However, there are no informations in the owncloud.log about this.
Server configuration
Operating system: CentOS 6.10
Web server: Apache
Database: MYSQL
PHP version: 7.2
ownCloud version: 10.4.1
Updated from an older ownCloud or fresh install: updated from older ownCloud
Where did you install ownCloud from: https://download.owncloud.org/community/owncloud-10.4.1.tar.bz2
Signing status (ownCloud 9.0 and above):
The content of config/config.php:
https://hastebin.com/givitefefo.json
List of activated apps:
Are you using external storage, if yes which one: No
Are you using encryption: No
Are you using an external user-backend, if yes which one: No
The text was updated successfully, but these errors were encountered: