Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downstream 2016-06-08 #25

Merged
merged 32 commits into from
Jun 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9108257
Added tests about overwriting files and folders as recipient
SergioBertolinSG Apr 14, 2016
dbaeedc
add overwriting using chunking but failing
SergioBertolinSG Apr 22, 2016
a2c7b2e
userUploadsChunkFileOfWithToWithChecksum has chunking-42 hardcoded
SergioBertolinSG Apr 22, 2016
57444b0
Added same test using old chunking
SergioBertolinSG Apr 22, 2016
8de206c
Added another case about overwriting folder using old chunking
SergioBertolinSG Apr 22, 2016
44f7241
Get a range from several chunks
SergioBertolinSG May 12, 2016
67c2c85
allow deleting "ghost files" trough the View and Node api
icewind1991 May 24, 2016
f4831f4
return success when deleting ghost files
icewind1991 Jun 3, 2016
18f7ced
Fix warnings when trying to get mtime of non existing files
icewind1991 Jun 3, 2016
16559e4
add test for deleting ghost files over dav
icewind1991 Jun 3, 2016
0041d89
Do not allow to store boolean configs, they behave unexpected on post…
nickvergessen Jun 6, 2016
ad33992
Fix Decrypt message via occ
davitol Jun 6, 2016
3b5c169
Comments fixed
davitol Jun 6, 2016
c4b80b8
Fix checkMove() implementation for dav v2 - fixes #24776 (#24971)
DeepDiver1975 Jun 6, 2016
e7a55c4
handle path not being set in shared cache (#24993)
icewind1991 Jun 6, 2016
d72d8c1
[tx-robot] updated from transifex
Jun 7, 2016
60e15e9
do not generate device token if 2FA is enable for user
ChristophWurst Jun 6, 2016
4f27c2c
Allow to decrypt user '0' files only
nickvergessen Jun 7, 2016
fad91e9
Fixed reviews
SergioBertolinSG Jun 7, 2016
75870c9
decrease initial users to load to 50
butonic Jun 7, 2016
a6134a6
Improve the UX for "not found" perma links
nickvergessen Jun 7, 2016
bee9186
dissalow symlinks in local storages that point outside the datadir
icewind1991 May 30, 2016
ea6921d
Ignore forbidden files while scanning
icewind1991 Jun 1, 2016
9b5fd51
Better handling of forbidden files in dav
icewind1991 Jun 1, 2016
7970ff2
don't update storage mtime if we can't get the modified date
icewind1991 Jun 7, 2016
8c7a32c
Fix GDrive upload file which name might match the one of a folder
Jun 7, 2016
49db297
make sure $data['mtime'] is always a timestamp
icewind1991 Jun 7, 2016
7f88645
Allow to cancel 2FA after login
nickvergessen Jun 7, 2016
6aab7d7
[tx-robot] updated from transifex
Jun 8, 2016
b0dd063
Bring back sharedstorage hooks
rullzer Jun 8, 2016
6ec2d12
Adjust test to work with phpunit < 5.2
nickvergessen Jun 8, 2016
bb67acf
ownCloud 9.1.0 beta 2
Jun 8, 2016
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
2 changes: 2 additions & 0 deletions apps/dav/lib/Connector/Sabre/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ public function getChild($name, $info = null) {
throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
} catch (\OCP\Files\InvalidPathException $ex) {
throw new InvalidPath($ex->getMessage());
} catch (ForbiddenException $e) {
throw new \Sabre\DAV\Exception\Forbidden();
}
}

Expand Down
9 changes: 4 additions & 5 deletions apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,19 @@ public function initialize(\Sabre\DAV\Server $server) {
*/
function checkMove($source, $destination) {
$sourceNode = $this->tree->getNodeForPath($source);
if ($sourceNode instanceof FutureFile) {
if (!$sourceNode instanceof Node) {
return;
}
list($sourceDir,) = \Sabre\HTTP\URLUtil::splitPath($source);
list($destinationDir,) = \Sabre\HTTP\URLUtil::splitPath($destination);

if ($sourceDir !== $destinationDir) {
$sourceFileInfo = $this->fileView->getFileInfo($source);

if ($sourceFileInfo === false) {
$sourceNodeFileInfo = $sourceNode->getFileInfo();
if (is_null($sourceNodeFileInfo)) {
throw new NotFound($source . ' does not exist');
}

if (!$sourceFileInfo->isDeletable()) {
if (!$sourceNodeFileInfo->isDeletable()) {
throw new Forbidden($source . " cannot be deleted");
}
}
Expand Down
4 changes: 4 additions & 0 deletions apps/dav/lib/Connector/Sabre/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,8 @@ public function releaseLock($type) {
public function changeLock($type) {
$this->fileView->changeLock($this->path, $type);
}

public function getFileInfo() {
return $this->info;
}
}
2 changes: 2 additions & 0 deletions apps/dav/lib/Connector/Sabre/ObjectTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ public function getNodeForPath($path) {
throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid');
} catch (LockedException $e) {
throw new \Sabre\DAV\Exception\Locked();
} catch (ForbiddenException $e) {
throw new \Sabre\DAV\Exception\Forbidden();
}
}

Expand Down
60 changes: 38 additions & 22 deletions apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;

use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCP\Files\StorageNotAvailableException;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
Expand All @@ -36,16 +37,16 @@
* See the COPYING-README file.
*/
class FilesPluginTest extends TestCase {
const GETETAG_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::GETETAG_PROPERTYNAME;
const FILEID_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::FILEID_PROPERTYNAME;
const INTERNAL_FILEID_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::INTERNAL_FILEID_PROPERTYNAME;
const SIZE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::SIZE_PROPERTYNAME;
const PERMISSIONS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::PERMISSIONS_PROPERTYNAME;
const LASTMODIFIED_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::LASTMODIFIED_PROPERTYNAME;
const DOWNLOADURL_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::DOWNLOADURL_PROPERTYNAME;
const OWNER_ID_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::OWNER_ID_PROPERTYNAME;
const OWNER_DISPLAY_NAME_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::OWNER_DISPLAY_NAME_PROPERTYNAME;
const DATA_FINGERPRINT_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::DATA_FINGERPRINT_PROPERTYNAME;
const GETETAG_PROPERTYNAME = FilesPlugin::GETETAG_PROPERTYNAME;
const FILEID_PROPERTYNAME = FilesPlugin::FILEID_PROPERTYNAME;
const INTERNAL_FILEID_PROPERTYNAME = FilesPlugin::INTERNAL_FILEID_PROPERTYNAME;
const SIZE_PROPERTYNAME = FilesPlugin::SIZE_PROPERTYNAME;
const PERMISSIONS_PROPERTYNAME = FilesPlugin::PERMISSIONS_PROPERTYNAME;
const LASTMODIFIED_PROPERTYNAME = FilesPlugin::LASTMODIFIED_PROPERTYNAME;
const DOWNLOADURL_PROPERTYNAME = FilesPlugin::DOWNLOADURL_PROPERTYNAME;
const OWNER_ID_PROPERTYNAME = FilesPlugin::OWNER_ID_PROPERTYNAME;
const OWNER_DISPLAY_NAME_PROPERTYNAME = FilesPlugin::OWNER_DISPLAY_NAME_PROPERTYNAME;
const DATA_FINGERPRINT_PROPERTYNAME = FilesPlugin::DATA_FINGERPRINT_PROPERTYNAME;

/**
* @var \Sabre\DAV\Server | \PHPUnit_Framework_MockObject_MockObject
Expand All @@ -58,7 +59,7 @@ class FilesPluginTest extends TestCase {
private $tree;

/**
* @var \OCA\DAV\Connector\Sabre\FilesPlugin
* @var FilesPlugin
*/
private $plugin;

Expand All @@ -84,11 +85,11 @@ public function setUp() {
->disableOriginalConstructor()
->getMock();
$this->config = $this->getMock('\OCP\IConfig');
$this->config->method('getSystemValue')
$this->config->expects($this->any())->method('getSystemValue')
->with($this->equalTo('data-fingerprint'), $this->equalTo(''))
->willReturn('my_fingerprint');

$this->plugin = new \OCA\DAV\Connector\Sabre\FilesPlugin(
$this->plugin = new FilesPlugin(
$this->tree,
$this->view,
$this->config
Expand Down Expand Up @@ -263,7 +264,7 @@ public function testGetPropertiesStorageNotAvailable() {
}

public function testGetPublicPermissions() {
$this->plugin = new \OCA\DAV\Connector\Sabre\FilesPlugin(
$this->plugin = new FilesPlugin(
$this->tree,
$this->view,
$this->config,
Expand Down Expand Up @@ -331,7 +332,7 @@ public function testGetPropertiesForRootDirectory() {
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
->disableOriginalConstructor()
->getMock();
$node->method('getPath')->willReturn('/');
$node->expects($this->any())->method('getPath')->willReturn('/');

$propFind = new PropFind(
'/',
Expand Down Expand Up @@ -432,11 +433,16 @@ public function testMoveSrcNotDeletable() {
->method('isDeletable')
->willReturn(false);

$this->view->expects($this->once())
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getFileInfo')
->with('FolderA/test.txt')
->willReturn($fileInfoFolderATestTXT);

$this->tree->expects($this->once())->method('getNodeForPath')
->willReturn($node);

$this->plugin->checkMove('FolderA/test.txt', 'test.txt');
}

Expand All @@ -448,11 +454,16 @@ public function testMoveSrcDeletable() {
->method('isDeletable')
->willReturn(true);

$this->view->expects($this->once())
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getFileInfo')
->with('FolderA/test.txt')
->willReturn($fileInfoFolderATestTXT);

$this->tree->expects($this->once())->method('getNodeForPath')
->willReturn($node);

$this->plugin->checkMove('FolderA/test.txt', 'test.txt');
}

Expand All @@ -461,10 +472,15 @@ public function testMoveSrcDeletable() {
* @expectedExceptionMessage FolderA/test.txt does not exist
*/
public function testMoveSrcNotExist() {
$this->view->expects($this->once())
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getFileInfo')
->with('FolderA/test.txt')
->willReturn(false);
->willReturn(null);

$this->tree->expects($this->once())->method('getNodeForPath')
->willReturn($node);

$this->plugin->checkMove('FolderA/test.txt', 'test.txt');
}
Expand Down
59 changes: 59 additions & 0 deletions apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
/**
* @author Joas Schilling <nickvergessen@owncloud.com>
* @author Robin Appelman <icewind@owncloud.com>
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
* @copyright Copyright (c) 2016, 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 OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;

use OC\Connector\Sabre\Exception\FileLocked;
use OCP\AppFramework\Http;
use OCP\Lock\ILockingProvider;

/**
* Class DeleteTest
*
* @group DB
*
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
class DeleteTest extends RequestTest {
public function testBasicUpload() {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');

$view->file_put_contents('foo.txt', 'asd');
$mount = $view->getMount('foo.txt');
$internalPath = $view->getAbsolutePath();

// create a ghost file
$mount->getStorage()->unlink($mount->getInternalPath($internalPath));

// cache entry still exists
$this->assertInstanceOf('\OCP\Files\FileInfo', $view->getFileInfo('foo.txt'));

$response = $this->request($view, $user, 'pass', 'DELETE', '/foo.txt');

$this->assertEquals(Http::STATUS_NO_CONTENT, $response->getStatus());

// no longer in the cache
$this->assertFalse($view->getFileInfo('foo.txt'));
}
}
6 changes: 6 additions & 0 deletions apps/federatedfilesharing/l10n/ar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OC.L10N.register(
"federatedfilesharing",
{
"Invalid Federated Cloud ID" : "معرّف السحابة المتحدة غير صالح"
},
"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;");
4 changes: 4 additions & 0 deletions apps/federatedfilesharing/l10n/ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ "translations": {
"Invalid Federated Cloud ID" : "معرّف السحابة المتحدة غير صالح"
},"pluralForm" :"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;"
}
3 changes: 3 additions & 0 deletions apps/files/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
this.$showHiddenFiles = $('input#showhiddenfilesToggle');
var showHidden = $('#showHiddenFiles').val() === "1";
this.$showHiddenFiles.prop('checked', showHidden);
if ($('#fileNotFound').val() === "1") {
OC.Notification.showTemporary(t('files', 'File could not be found'));
}

this._filesConfig = new OC.Backbone.Model({
showhidden: showHidden
Expand Down
6 changes: 6 additions & 0 deletions apps/files/l10n/da.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ OC.L10N.register(
"Could not get result from server." : "Kunne ikke hente resultat fra server.",
"Uploading..." : "Uploader...",
"..." : "...",
"Any moment now..." : "Når som helst...",
"Soon..." : "Snart...",
"File upload is in progress. Leaving the page now will cancel the upload." : "Fil upload kører. Hvis du forlader siden nu, vil uploadet blive annuleret.",
"Actions" : "Handlinger",
"Download" : "Download",
Expand All @@ -47,6 +49,8 @@ OC.L10N.register(
"This directory is unavailable, please check the logs or contact the administrator" : "Denne mappe er utilgængelig, tjek venligst loggene eller kontakt administratoren",
"Could not move \"{file}\", target exists" : "Kunne ikke flytte \"{file}\" - der findes allerede en fil med dette navn",
"Could not move \"{file}\"" : "Kunne ikke flytte \"{file}\"",
"{newName} already exists" : "{newName} eksistere allerede",
"Error deleting file \"{fileName}\"." : "Fejl under sletning af filen \"{fileName}\"",
"No entries in this folder match '{filter}'" : "Der er ingen poster i denne mappe, der matcher '{filter}'",
"Name" : "Navn",
"Size" : "Størrelse",
Expand All @@ -68,6 +72,7 @@ OC.L10N.register(
"_%n byte_::_%n bytes_" : ["%n byte","%n bytes"],
"Favorited" : "Gjort til foretrukken",
"Favorite" : "Foretrukken",
"Local link" : "Lokalt link",
"Folder" : "Mappe",
"New folder" : "Ny Mappe",
"{newname} already exists" : "{newname} eksistere allerede",
Expand Down Expand Up @@ -97,6 +102,7 @@ OC.L10N.register(
"Save" : "Gem",
"Missing permissions to edit from here." : "Rettighed mangler til at redigere på dette sted",
"Settings" : "Indstillinger",
"Show hidden files" : "Vis skjulte filer",
"WebDAV" : "WebDAV",
"No files in here" : "Her er ingen filer",
"Upload some content or sync with your devices!" : "Overfør indhold eller synkronisér med dine enheder!",
Expand Down
6 changes: 6 additions & 0 deletions apps/files/l10n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"Could not get result from server." : "Kunne ikke hente resultat fra server.",
"Uploading..." : "Uploader...",
"..." : "...",
"Any moment now..." : "Når som helst...",
"Soon..." : "Snart...",
"File upload is in progress. Leaving the page now will cancel the upload." : "Fil upload kører. Hvis du forlader siden nu, vil uploadet blive annuleret.",
"Actions" : "Handlinger",
"Download" : "Download",
Expand All @@ -45,6 +47,8 @@
"This directory is unavailable, please check the logs or contact the administrator" : "Denne mappe er utilgængelig, tjek venligst loggene eller kontakt administratoren",
"Could not move \"{file}\", target exists" : "Kunne ikke flytte \"{file}\" - der findes allerede en fil med dette navn",
"Could not move \"{file}\"" : "Kunne ikke flytte \"{file}\"",
"{newName} already exists" : "{newName} eksistere allerede",
"Error deleting file \"{fileName}\"." : "Fejl under sletning af filen \"{fileName}\"",
"No entries in this folder match '{filter}'" : "Der er ingen poster i denne mappe, der matcher '{filter}'",
"Name" : "Navn",
"Size" : "Størrelse",
Expand All @@ -66,6 +70,7 @@
"_%n byte_::_%n bytes_" : ["%n byte","%n bytes"],
"Favorited" : "Gjort til foretrukken",
"Favorite" : "Foretrukken",
"Local link" : "Lokalt link",
"Folder" : "Mappe",
"New folder" : "Ny Mappe",
"{newname} already exists" : "{newname} eksistere allerede",
Expand Down Expand Up @@ -95,6 +100,7 @@
"Save" : "Gem",
"Missing permissions to edit from here." : "Rettighed mangler til at redigere på dette sted",
"Settings" : "Indstillinger",
"Show hidden files" : "Vis skjulte filer",
"WebDAV" : "WebDAV",
"No files in here" : "Her er ingen filer",
"Upload some content or sync with your devices!" : "Overfør indhold eller synkronisér med dine enheder!",
Expand Down
Loading