aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/api
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-27 15:42:11 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-27 20:34:06 +0100
commit35a3432793919303726a7ea03d6a714db4b40707 (patch)
treed91236b15c271d78f40cb6539f99db8f1ffba8db /apps/files_sharing/api
parent90f2a2352de876a5b125df2b9817f78790b25805 (diff)
downloadnextcloud-server-35a3432793919303726a7ea03d6a714db4b40707.tar.gz
nextcloud-server-35a3432793919303726a7ea03d6a714db4b40707.zip
[Share 2.0] When passing empty strings don't fail
The password and expiration date can be set to empty strings when created. This is now handled gracefully.
Diffstat (limited to 'apps/files_sharing/api')
-rw-r--r--apps/files_sharing/api/share20ocs.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php
index 3048eb7cd1a..081c3b16999 100644
--- a/apps/files_sharing/api/share20ocs.php
+++ b/apps/files_sharing/api/share20ocs.php
@@ -272,12 +272,12 @@ class Share20OCS {
if ($publicUpload === 'true') {
// Check if public upload is allowed
if (!$this->shareManager->shareApiLinkAllowPublicUpload()) {
- return new \OC_OCS_Result(null, 403, '"public upload disabled by the administrator');
+ return new \OC_OCS_Result(null, 403, 'public upload disabled by the administrator');
}
// Public upload can only be set for folders
if ($path instanceof \OCP\Files\File) {
- return new \OC_OCS_Result(null, 404, '"public upload is only possible for public shared folders');
+ return new \OC_OCS_Result(null, 404, 'public upload is only possible for public shared folders');
}
$share->setPermissions(
@@ -290,12 +290,16 @@ class Share20OCS {
}
// Set password
- $share->setPassword($this->request->getParam('password', null));
+ $password = $this->request->getParam('password', '');
+
+ if ($password !== '') {
+ $share->setPassword($password);
+ }
//Expire date
- $expireDate = $this->request->getParam('expireDate', null);
+ $expireDate = $this->request->getParam('expireDate', '');
- if ($expireDate !== null) {
+ if ($expireDate !== '') {
try {
$expireDate = $this->parseDate($expireDate);
$share->setExpirationDate($expireDate);