Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions apps/files/ajax/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,22 @@
die();
}
} else {
$shareManager = \OC::$server->getShareManager();
$share = $shareManager->getShareByToken((string)$_POST['dirToken']);

// TODO: ideally this code should be in files_sharing/ajax/upload.php
// and the upload/file transfer code needs to be refactored into a utility method
// that could be used there

\OC_User::setIncognitoMode(true);

$publicDirectory = !empty($_POST['subdir']) ? (string)$_POST['subdir'] : '/';
// If it is a write-only folder no subdirectory can be specified
$publicDirectory = '';
if ($share->getPermissions() & \OCP\Constants::PERMISSION_READ) {
$publicDirectory = !empty($_POST['subdir']) ? (string)$_POST['subdir'] : '/';
} else {
$_POST['file_directory'] = '';
}

$linkItem = OCP\Share::getShareByToken((string)$_POST['dirToken']);
if ($linkItem === false) {
Expand Down Expand Up @@ -165,8 +174,6 @@

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';
}
Expand Down