diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-06-09 17:45:16 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-06-09 17:55:26 +0200 |
commit | 6e99b0f59d3b0278c45d42dcec01ff554a89d979 (patch) | |
tree | e7f60f51f36517f15bd6a91e5d5bd1c1739f3d20 /apps/files/ajax | |
parent | 5fdde426eb416b470bc37c86a518c49767a55251 (diff) | |
download | nextcloud-server-6e99b0f59d3b0278c45d42dcec01ff554a89d979.tar.gz nextcloud-server-6e99b0f59d3b0278c45d42dcec01ff554a89d979.zip |
Make uploading possible via select and cleanup CSS
Diffstat (limited to 'apps/files/ajax')
-rw-r--r-- | apps/files/ajax/upload.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 9cc9c279700..98066845734 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -161,6 +161,15 @@ if (\OC\Files\Filesystem::isValidPath($dir) === true) { $resolution = null; } + if(isset($_POST['dirToken'])) { + // If it is a read only share the resolution will always be autorename + $shareManager = \OC::$server->getShareManager(); + $share = $shareManager->getShareByToken((string)$_POST['dirToken']); + if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { + $resolution = 'autorename'; + } + } + // target directory for when uploading folders $relativePath = ''; if(!empty($_POST['file_directory'])) { @@ -247,6 +256,20 @@ if (\OC\Files\Filesystem::isValidPath($dir) === true) { } if ($error === false) { + // Do not leak file information if it is a read-only share + if(isset($_POST['dirToken'])) { + $shareManager = \OC::$server->getShareManager(); + $share = $shareManager->getShareByToken((string)$_POST['dirToken']); + if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { + $newResults = []; + foreach($result as $singleResult) { + $fileName = $singleResult['originalname']; + $newResults['filename'] = $fileName; + $newResults['mimetype'] = \OC::$server->getMimeTypeDetector()->detectPath($fileName); + } + $result = $newResults; + } + } OCP\JSON::encodedPrint($result); } else { OCP\JSON::error(array(array('data' => array_merge(array('message' => $error, 'code' => $errorCode), $storageStats)))); |