Browse Source
Properly catch whether a share is `null`
Properly catch whether a share is `null`
Despite it's PHPDoc the function might return `null` which was not properly catched and thus in some situations the share was resolved to the sharing users root directory. To test this perform the following steps: * Share file in owncloud 7 (7.0.4.2) * Delete the parent folder of the shared file * The share stays is in the DB and the share via the sharelink is inaccessible. (which is good) * Upgrade to owncloud 8 (8.0.2) (This step is crucial. The bug is not reproduceable without upgrading from 7 to 8. It seems like the old tokens are handled different than the newer ones) * Optional Step: Logout, Reset Browser Session, etc. * Access the share via the old share url: almost empty page, but there is a dowload button which adds a "/download" to the URL. * Upon clicking, a download.zip is downloaded which contains EVERYTHING from the owncloud directory (of the user who shared the file) * No exception is thrown and no error is logged. This will add a check whether the share is a valid one and also adds unit tests to prevent further regressions in the future. Needs to be backported to ownCloud 8. Adding a proper clean-up of the orphaned shares is out-of-scope and would probably require some kind of FK or so. Fixes https://github.com/owncloud/core/issues/15097remotes/origin/etag-endpoint
5 changed files with 128 additions and 23 deletions
-
5apps/files_sharing/application.php
-
38apps/files_sharing/lib/controllers/sharecontroller.php
-
3apps/files_sharing/lib/middleware/sharingcheckmiddleware.php
-
62apps/files_sharing/tests/controller/sharecontroller.php
-
43lib/public/appframework/http/notfoundresponse.php
@ -0,0 +1,43 @@ |
|||
<?php |
|||
/** |
|||
* @author Lukas Reschke <lukas@owncloud.com> |
|||
* |
|||
* @copyright Copyright (c) 2015, ownCloud, Inc. |
|||
* @license AGPL-3.0 |
|||
* |
|||
* This code is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU Affero General Public License, version 3, |
|||
* as published by the Free Software Foundation. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Affero General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Affero General Public License, version 3, |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|||
* |
|||
*/ |
|||
|
|||
namespace OCP\AppFramework\Http; |
|||
|
|||
use OCP\AppFramework\Http; |
|||
use OCP\Template; |
|||
|
|||
/** |
|||
* A generic 404 response showing an 404 error page as well to the end-user |
|||
*/ |
|||
class NotFoundResponse extends Response { |
|||
|
|||
public function __construct() { |
|||
$this->setStatus(404); |
|||
} |
|||
|
|||
/** |
|||
* @return string |
|||
*/ |
|||
public function render() { |
|||
$template = new Template('core', '404', 'guest'); |
|||
return $template->fetchPage(); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue