diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-08 02:27:21 -0700 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-08 02:27:21 -0700 |
commit | 0365d244e0b41785d7853f43d6b60017e9983cae (patch) | |
tree | f29b0f9f45e70f33c2362557f2cd135d7f271cb2 /apps/files | |
parent | 9b9ea7cd8e9050bd3682c1edd81955469bc8474d (diff) | |
parent | c956a08d2219d623af4ceca644411c8217fe0cbf (diff) | |
download | nextcloud-server-0365d244e0b41785d7853f43d6b60017e9983cae.tar.gz nextcloud-server-0365d244e0b41785d7853f43d6b60017e9983cae.zip |
Merge pull request #3946 from owncloud/fixing-3942-master
handle anonymous upload to reshared folder
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/ajax/upload.php | 29 | ||||
-rw-r--r-- | apps/files/index.php | 1 |
2 files changed, 14 insertions, 16 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 54604d10563..dde5d3c50af 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -26,21 +26,18 @@ if (empty($_POST['dirToken'])) { if (!($linkItem['permissions'] & OCP\PERMISSION_CREATE)) { OCP\JSON::checkLoggedIn(); } else { + // resolve reshares + $rootLinkItem = OCP\Share::resolveReShare($linkItem); + // Setup FS with owner OC_Util::tearDownFS(); - OC_Util::setupFS($linkItem['uid_owner']); - - // translate linkItem to the real folder name on the file system - $sharedItem = OCP\Share::getSharedItem($linkItem['item_type'], $linkItem['item_source'], $linkItem['uid_owner']); - if (!$sharedItem || empty($sharedItem) || $sharedItem === false) { - OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); - die(); - } + OC_Util::setupFS($rootLinkItem['uid_owner']); // The token defines the target directory (security reasons) + $path = \OC\Files\Filesystem::getPath($linkItem['file_source']); $dir = sprintf( "/%s/%s", - $sharedItem['path'], + $path, isset($_POST['subdir']) ? $_POST['subdir'] : '' ); @@ -83,17 +80,17 @@ $files = $_FILES['files']; $error = ''; -$maxUploadFilesize = OCP\Util::maxUploadFilesize($dir); -$maxHumanFilesize = OCP\Util::humanFileSize($maxUploadFilesize); +$maxUploadFileSize = $storageStats['uploadMaxFilesize']; +$maxHumanFileSize = OCP\Util::humanFileSize($maxUploadFileSize); $totalSize = 0; foreach ($files['size'] as $size) { $totalSize += $size; } -if ($maxUploadFilesize >= 0 and $totalSize > $maxUploadFilesize) { +if ($maxUploadFileSize >= 0 and $totalSize > $maxUploadFileSize) { OCP\JSON::error(array('data' => array('message' => $l->t('Not enough storage available'), - 'uploadMaxFilesize' => $maxUploadFilesize, - 'maxHumanFilesize' => $maxHumanFilesize))); + 'uploadMaxFilesize' => $maxUploadFileSize, + 'maxHumanFilesize' => $maxHumanFileSize))); exit(); } @@ -115,8 +112,8 @@ if (strpos($dir, '..') === false) { 'id' => $meta['fileid'], 'name' => basename($target), 'originalname' => $files['name'][$i], - 'uploadMaxFilesize' => $maxUploadFilesize, - 'maxHumanFilesize' => $maxHumanFilesize + 'uploadMaxFilesize' => $maxUploadFileSize, + 'maxHumanFilesize' => $maxHumanFileSize ); } } diff --git a/apps/files/index.php b/apps/files/index.php index 640c28c0075..2338cf439e4 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -137,5 +137,6 @@ if ($needUpgrade) { $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); + $tmpl->assign('isPublic', false); $tmpl->printPage(); } |