diff options
Diffstat (limited to 'apps')
22 files changed, 99 insertions, 254 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index ddab34605f3..e7226b58196 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -196,8 +196,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node 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(); } } diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index dc47416cca8..a4e13709559 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -168,19 +168,20 @@ class FilesPlugin extends ServerPlugin { */ function checkMove($source, $destination) { $sourceNode = $this->tree->getNodeForPath($source); - if (!$sourceNode instanceof Node) { + if ($sourceNode instanceof FutureFile) { return; } list($sourceDir,) = \Sabre\HTTP\URLUtil::splitPath($source); list($destinationDir,) = \Sabre\HTTP\URLUtil::splitPath($destination); if ($sourceDir !== $destinationDir) { - $sourceNodeFileInfo = $sourceNode->getFileInfo(); - if (is_null($sourceNodeFileInfo)) { + $sourceFileInfo = $this->fileView->getFileInfo($source); + + if ($sourceFileInfo === false) { throw new NotFound($source . ' does not exist'); } - if (!$sourceNodeFileInfo->isDeletable()) { + if (!$sourceFileInfo->isDeletable()) { throw new Forbidden($source . " cannot be deleted"); } } diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index c41b5137fde..04640bbde4f 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -347,8 +347,4 @@ abstract class Node implements \Sabre\DAV\INode { public function changeLock($type) { $this->fileView->changeLock($this->path, $type); } - - public function getFileInfo() { - return $this->info; - } } diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index 9e7d876187d..599f3fdfd0e 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -161,8 +161,6 @@ class ObjectTree extends \Sabre\DAV\Tree { 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(); } } diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index 80f284e470e..87fec17bf6b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -24,7 +24,6 @@ */ 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; @@ -37,16 +36,16 @@ use Test\TestCase; * See the COPYING-README file. */ class FilesPluginTest extends TestCase { - 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; + 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; /** * @var \Sabre\DAV\Server | \PHPUnit_Framework_MockObject_MockObject @@ -59,7 +58,7 @@ class FilesPluginTest extends TestCase { private $tree; /** - * @var FilesPlugin + * @var \OCA\DAV\Connector\Sabre\FilesPlugin */ private $plugin; @@ -85,11 +84,11 @@ class FilesPluginTest extends TestCase { ->disableOriginalConstructor() ->getMock(); $this->config = $this->getMock('\OCP\IConfig'); - $this->config->expects($this->any())->method('getSystemValue') + $this->config->method('getSystemValue') ->with($this->equalTo('data-fingerprint'), $this->equalTo('')) ->willReturn('my_fingerprint'); - $this->plugin = new FilesPlugin( + $this->plugin = new \OCA\DAV\Connector\Sabre\FilesPlugin( $this->tree, $this->view, $this->config @@ -264,7 +263,7 @@ class FilesPluginTest extends TestCase { } public function testGetPublicPermissions() { - $this->plugin = new FilesPlugin( + $this->plugin = new \OCA\DAV\Connector\Sabre\FilesPlugin( $this->tree, $this->view, $this->config, @@ -332,7 +331,7 @@ class FilesPluginTest extends TestCase { $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory') ->disableOriginalConstructor() ->getMock(); - $node->expects($this->any())->method('getPath')->willReturn('/'); + $node->method('getPath')->willReturn('/'); $propFind = new PropFind( '/', @@ -433,16 +432,11 @@ class FilesPluginTest extends TestCase { ->method('isDeletable') ->willReturn(false); - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') - ->disableOriginalConstructor() - ->getMock(); - $node->expects($this->once()) + $this->view->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'); } @@ -454,16 +448,11 @@ class FilesPluginTest extends TestCase { ->method('isDeletable') ->willReturn(true); - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') - ->disableOriginalConstructor() - ->getMock(); - $node->expects($this->once()) + $this->view->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'); } @@ -472,15 +461,10 @@ class FilesPluginTest extends TestCase { * @expectedExceptionMessage FolderA/test.txt does not exist */ public function testMoveSrcNotExist() { - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') - ->disableOriginalConstructor() - ->getMock(); - $node->expects($this->once()) + $this->view->expects($this->once()) ->method('getFileInfo') - ->willReturn(null); - - $this->tree->expects($this->once())->method('getNodeForPath') - ->willReturn($node); + ->with('FolderA/test.txt') + ->willReturn(false); $this->plugin->checkMove('FolderA/test.txt', 'test.txt'); } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php deleted file mode 100644 index 4f481cba557..00000000000 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php +++ /dev/null @@ -1,59 +0,0 @@ -<?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')); - } -} diff --git a/apps/federatedfilesharing/l10n/ar.js b/apps/federatedfilesharing/l10n/ar.js deleted file mode 100644 index 451663a7b6b..00000000000 --- a/apps/federatedfilesharing/l10n/ar.js +++ /dev/null @@ -1,6 +0,0 @@ -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;"); diff --git a/apps/federatedfilesharing/l10n/ar.json b/apps/federatedfilesharing/l10n/ar.json deleted file mode 100644 index 630ab95f64b..00000000000 --- a/apps/federatedfilesharing/l10n/ar.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "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;" -}
\ No newline at end of file diff --git a/apps/files/js/app.js b/apps/files/js/app.js index fbfa510e07e..7a3d78f9663 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -53,9 +53,6 @@ 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 diff --git a/apps/files/l10n/da.js b/apps/files/l10n/da.js index e585ccacc1c..e1013bcafbb 100644 --- a/apps/files/l10n/da.js +++ b/apps/files/l10n/da.js @@ -32,8 +32,6 @@ 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", @@ -49,8 +47,6 @@ 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", @@ -72,7 +68,6 @@ 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", @@ -102,7 +97,6 @@ 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!", diff --git a/apps/files/l10n/da.json b/apps/files/l10n/da.json index 499533d77ba..3162770cc40 100644 --- a/apps/files/l10n/da.json +++ b/apps/files/l10n/da.json @@ -30,8 +30,6 @@ "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", @@ -47,8 +45,6 @@ "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", @@ -70,7 +66,6 @@ "_%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", @@ -100,7 +95,6 @@ "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!", diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 18b6cf719c5..1b0903b41d3 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -27,9 +27,9 @@ namespace OCA\Files\Controller; use OC\AppFramework\Http\Request; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\ContentSecurityPolicy; +use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; -use OCP\Files\NotFoundException; use OCP\IConfig; use OCP\IL10N; use OCP\INavigationManager; @@ -37,6 +37,7 @@ use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUserSession; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use OCP\AppFramework\Http\NotFoundResponse; use OCP\Files\Folder; use OCP\App\IAppManager; @@ -141,15 +142,11 @@ class ViewController extends Controller { * @param string $view * @param string $fileid * @return TemplateResponse + * @throws \OCP\Files\NotFoundException */ public function index($dir = '', $view = '', $fileid = null) { - $fileNotFound = false; if ($fileid !== null) { - try { - return $this->showFile($fileid); - } catch (NotFoundException $e) { - $fileNotFound = true; - } + return $this->showFile($fileid); } $nav = new \OCP\Template('files', 'appnavigation', ''); @@ -248,7 +245,6 @@ class ViewController extends Controller { $params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc'); $showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false); $params['showHiddenFiles'] = $showHidden ? 1 : 0; - $params['fileNotFound'] = $fileNotFound ? 1 : 0; $params['appNavigation'] = $nav; $params['appContents'] = $contentItems; $this->navigationManager->setActiveEntry('files_index'); @@ -269,37 +265,40 @@ class ViewController extends Controller { * Redirects to the file list and highlight the given file id * * @param string $fileId file id to show - * @return RedirectResponse redirect response or not found response - * @throws \OCP\Files\NotFoundException + * @return Response redirect response or not found response * * @NoCSRFRequired * @NoAdminRequired */ public function showFile($fileId) { - $uid = $this->userSession->getUser()->getUID(); - $baseFolder = $this->rootFolder->get($uid . '/files/'); - $files = $baseFolder->getById($fileId); - $params = []; - - if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) { - $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/'); + try { + $uid = $this->userSession->getUser()->getUID(); + $baseFolder = $this->rootFolder->get($uid . '/files/'); $files = $baseFolder->getById($fileId); - $params['view'] = 'trashbin'; - } + $params = []; + + if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) { + $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/'); + $files = $baseFolder->getById($fileId); + $params['view'] = 'trashbin'; + } - if (!empty($files)) { - $file = current($files); - if ($file instanceof Folder) { - // set the full path to enter the folder - $params['dir'] = $baseFolder->getRelativePath($file->getPath()); - } else { - // set parent path as dir - $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath()); - // and scroll to the entry - $params['scrollto'] = $file->getName(); + if (!empty($files)) { + $file = current($files); + if ($file instanceof Folder) { + // set the full path to enter the folder + $params['dir'] = $baseFolder->getRelativePath($file->getPath()); + } else { + // set parent path as dir + $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath()); + // and scroll to the entry + $params['scrollto'] = $file->getName(); + } + return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params)); } - return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params)); + } catch (\OCP\Files\NotFoundException $e) { + return new NotFoundResponse(); } - throw new \OCP\Files\NotFoundException(); + return new NotFoundResponse(); } } diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 42ce941a4a5..7281edd3aec 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -14,7 +14,6 @@ <input type="hidden" name="usedSpacePercent" id="usedSpacePercent" value="<?php p($_['usedSpacePercent']); ?>" /> <input type="hidden" name="owner" id="owner" value="<?php p($_['owner']); ?>" /> <input type="hidden" name="ownerDisplayName" id="ownerDisplayName" value="<?php p($_['ownerDisplayName']); ?>" /> -<input type="hidden" name="fileNotFound" id="fileNotFound" value="<?php p($_['fileNotFound']); ?>"" /> <?php if (!$_['isPublic']) :?> <input type="hidden" name="mailNotificationEnabled" id="mailNotificationEnabled" value="<?php p($_['mailNotificationEnabled']) ?>" /> <input type="hidden" name="mailPublicNotificationEnabled" id="mailPublicNotificationEnabled" value="<?php p($_['mailPublicNotificationEnabled']) ?>" /> diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index 34c40ecea5c..049f44fc0af 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -26,7 +26,6 @@ namespace OCA\Files\Tests\Controller; use OCA\Files\Controller\ViewController; use OCP\AppFramework\Http; -use OCP\Files\NotFoundException; use OCP\IUser; use OCP\Template; use Test\TestCase; @@ -260,8 +259,7 @@ class ViewControllerTest extends TestCase { 'isPublic' => false, 'defaultFileSorting' => 'name', 'defaultFileSortingDirection' => 'asc', - 'showHiddenFiles' => 0, - 'fileNotFound' => 0, + 'showHiddenFiles' => false, 'mailNotificationEnabled' => 'no', 'mailPublicNotificationEnabled' => 'no', 'allowShareWithLink' => 'yes', @@ -412,14 +410,11 @@ class ViewControllerTest extends TestCase { ->with(123) ->will($this->returnValue([])); + $expected = new Http\NotFoundResponse(); if ($useShowFile) { - $this->setExpectedException('OCP\Files\NotFoundException'); - $this->viewController->showFile(123); + $this->assertEquals($expected, $this->viewController->showFile(123)); } else { - $response = $this->viewController->index('MyDir', 'MyView', '123'); - $this->assertInstanceOf('OCP\AppFramework\Http\TemplateResponse', $response); - $params = $response->getParams(); - $this->assertEquals(1, $params['fileNotFound']); + $this->assertEquals($expected, $this->viewController->index('/whatever', '', '123')); } } diff --git a/apps/files_external/l10n/pt_PT.js b/apps/files_external/l10n/pt_PT.js index 68f183a36b3..9d3998d903b 100644 --- a/apps/files_external/l10n/pt_PT.js +++ b/apps/files_external/l10n/pt_PT.js @@ -7,13 +7,13 @@ OC.L10N.register( "Step 1 failed. Exception: %s" : "Passo 1 falhou. Exceção: %s", "Step 2 failed. Exception: %s" : "Passo 2 falhou. Exceção: %s", "External storage" : "Armazenamento Externo", - "Dropbox App Configuration" : "Configuração da aplicação Dropbox", - "Google Drive App Configuration" : "Configuração da aplicação Google Drive", + "Dropbox App Configuration" : "Configuração da app Dropbox", + "Google Drive App Configuration" : "Configuração da app Google Drive", "Personal" : "Pessoal", "System" : "Sistema", "Grant access" : "Conceder acesso", - "Error configuring OAuth1" : "Erro ao configurar OAuth1", - "Error configuring OAuth2" : "Erro ao configurar OAuth2", + "Error configuring OAuth1" : "Erro de configuração OAuth1", + "Error configuring OAuth2" : "Erro de configuração OAuth2", "Generate keys" : "Gerar chaves", "Error generating key pair" : "Erro ao gerar chave par", "All users. Type to select user or group." : "Todos os utilizadores. Digite para selecionar o utilizador ou grupo.", @@ -27,14 +27,14 @@ OC.L10N.register( "Couldn't get the list of external mount points: {type}" : "Não foi possível conseguir a lista de pontos de montagem externos: {type}", "There was an error with message: " : "Houve um erro com a mensagem:", "External mount error" : "Erro de montagem externa", - "external-storage" : "armazenamento externo", + "external-storage" : "Armazenamento Externo", "Couldn't get the list of Windows network drive mount points: empty response from the server" : "Não foi possível conseguir a lista de pontos de montagem Windows na rede: resposta vazia do servidor", "Some of the configured external mount points are not connected. Please click on the red row(s) for more information" : "Alguns dos pontos de montagem externos configurados não estão conectados. Por favor, clique na fila vermelha para mais informação", "Please enter the credentials for the {mount} mount" : "Por favor, introduza as credenciais para {mount}", "Username" : "Nome de utilizador", "Password" : "Palavra-passe", "Credentials saved" : "Credenciais guardadas", - "Credentials saving failed" : "Falha ao guardar as credenciais", + "Credentials saving failed" : "Falha ao salvar credenciais", "Credentials required" : "Credenciais necessárias", "Save" : "Guardar", "Storage with id \"%i\" not found" : "Não foi encontrado o armazenamento com a id. \"%i\"", @@ -49,7 +49,7 @@ OC.L10N.register( "Insufficient data: %s" : "Dados insuficientes: %s", "%s" : "%s", "Storage with id \"%i\" is not user editable" : "Armazenamento com id \"%i\" não é editável pelo utilizador", - "Access key" : "Chave de acesso", + "Access key" : "Código de acesso", "Secret key" : "Código secreto", "Builtin" : "Integrado", "None" : "Nenhum", diff --git a/apps/files_external/l10n/pt_PT.json b/apps/files_external/l10n/pt_PT.json index 93922c67762..fab0f05a830 100644 --- a/apps/files_external/l10n/pt_PT.json +++ b/apps/files_external/l10n/pt_PT.json @@ -5,13 +5,13 @@ "Step 1 failed. Exception: %s" : "Passo 1 falhou. Exceção: %s", "Step 2 failed. Exception: %s" : "Passo 2 falhou. Exceção: %s", "External storage" : "Armazenamento Externo", - "Dropbox App Configuration" : "Configuração da aplicação Dropbox", - "Google Drive App Configuration" : "Configuração da aplicação Google Drive", + "Dropbox App Configuration" : "Configuração da app Dropbox", + "Google Drive App Configuration" : "Configuração da app Google Drive", "Personal" : "Pessoal", "System" : "Sistema", "Grant access" : "Conceder acesso", - "Error configuring OAuth1" : "Erro ao configurar OAuth1", - "Error configuring OAuth2" : "Erro ao configurar OAuth2", + "Error configuring OAuth1" : "Erro de configuração OAuth1", + "Error configuring OAuth2" : "Erro de configuração OAuth2", "Generate keys" : "Gerar chaves", "Error generating key pair" : "Erro ao gerar chave par", "All users. Type to select user or group." : "Todos os utilizadores. Digite para selecionar o utilizador ou grupo.", @@ -25,14 +25,14 @@ "Couldn't get the list of external mount points: {type}" : "Não foi possível conseguir a lista de pontos de montagem externos: {type}", "There was an error with message: " : "Houve um erro com a mensagem:", "External mount error" : "Erro de montagem externa", - "external-storage" : "armazenamento externo", + "external-storage" : "Armazenamento Externo", "Couldn't get the list of Windows network drive mount points: empty response from the server" : "Não foi possível conseguir a lista de pontos de montagem Windows na rede: resposta vazia do servidor", "Some of the configured external mount points are not connected. Please click on the red row(s) for more information" : "Alguns dos pontos de montagem externos configurados não estão conectados. Por favor, clique na fila vermelha para mais informação", "Please enter the credentials for the {mount} mount" : "Por favor, introduza as credenciais para {mount}", "Username" : "Nome de utilizador", "Password" : "Palavra-passe", "Credentials saved" : "Credenciais guardadas", - "Credentials saving failed" : "Falha ao guardar as credenciais", + "Credentials saving failed" : "Falha ao salvar credenciais", "Credentials required" : "Credenciais necessárias", "Save" : "Guardar", "Storage with id \"%i\" not found" : "Não foi encontrado o armazenamento com a id. \"%i\"", @@ -47,7 +47,7 @@ "Insufficient data: %s" : "Dados insuficientes: %s", "%s" : "%s", "Storage with id \"%i\" is not user editable" : "Armazenamento com id \"%i\" não é editável pelo utilizador", - "Access key" : "Chave de acesso", + "Access key" : "Código de acesso", "Secret key" : "Código secreto", "Builtin" : "Integrado", "None" : "Nenhum", diff --git a/apps/files_external/lib/Lib/Storage/Google.php b/apps/files_external/lib/Lib/Storage/Google.php index 49fde7d066f..2a1ff768e2c 100644 --- a/apps/files_external/lib/Lib/Storage/Google.php +++ b/apps/files_external/lib/Lib/Storage/Google.php @@ -97,9 +97,6 @@ class Google extends \OC\Files\Storage\Common { private function getDriveFile($path) { // Remove leading and trailing slashes $path = trim($path, '/'); - if ($path === '.') { - $path = ''; - } if (isset($this->driveFiles[$path])) { return $this->driveFiles[$path]; } else if ($path === '') { @@ -141,7 +138,7 @@ class Google extends \OC\Files\Storage\Common { if ($pos !== false) { $pathWithoutExt = substr($path, 0, $pos); $file = $this->getDriveFile($pathWithoutExt); - if ($file && $this->isGoogleDocFile($file)) { + if ($file) { // Switch cached Google_Service_Drive_DriveFile to the correct index unset($this->driveFiles[$pathWithoutExt]); $this->driveFiles[$path] = $file; @@ -211,17 +208,6 @@ class Google extends \OC\Files\Storage\Common { } } - /** - * Returns whether the given drive file is a Google Doc file - * - * @param \Google_Service_Drive_DriveFile - * - * @return true if the file is a Google Doc file, false otherwise - */ - private function isGoogleDocFile($file) { - return $this->getGoogleDocExtension($file->getMimeType()) !== ''; - } - public function mkdir($path) { if (!$this->is_dir($path)) { $parentFolder = $this->getDriveFile(dirname($path)); diff --git a/apps/files_external/tests/Storage/GoogleTest.php b/apps/files_external/tests/Storage/GoogleTest.php index eb19cc463b1..7684fec8429 100644 --- a/apps/files_external/tests/Storage/GoogleTest.php +++ b/apps/files_external/tests/Storage/GoogleTest.php @@ -60,13 +60,4 @@ class GoogleTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - - public function testSameNameAsFolderWithExtension() { - $this->assertTrue($this->instance->mkdir('testsamename')); - $this->assertEquals(13, $this->instance->file_put_contents('testsamename.txt', 'some contents')); - $this->assertEquals('some contents', $this->instance->file_get_contents('testsamename.txt')); - $this->assertTrue($this->instance->is_dir('testsamename')); - $this->assertTrue($this->instance->unlink('testsamename.txt')); - $this->assertTrue($this->instance->rmdir('testsamename')); - } } diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index a0519cadbaa..82d885a8ef3 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -81,7 +81,7 @@ class Cache extends CacheJail { } protected function formatCacheEntry($entry) { - $path = isset($entry['path']) ? $entry['path'] : ''; + $path = $entry['path']; $entry = parent::formatCacheEntry($entry); $sharePermissions = $this->storage->getPermissions($path); if (isset($entry['permissions'])) { diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index b5b5e416884..965c4d36cad 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -415,22 +415,4 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { return $this->sourceStorage; } - public function file_get_contents($path) { - $info = [ - 'target' => $this->getMountPoint() . '/' . $path, - 'source' => $this->getSourcePath($path), - ]; - \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_get_contents', $info); - return parent::file_get_contents($path); - } - - public function file_put_contents($path, $data) { - $info = [ - 'target' => $this->getMountPoint() . '/' . $path, - 'source' => $this->getSourcePath($path), - ]; - \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_put_contents', $info); - return parent::file_put_contents($path, $data); - } - } diff --git a/apps/systemtags/l10n/fr.js b/apps/systemtags/l10n/fr.js index 387bc45643c..93c7d364b24 100644 --- a/apps/systemtags/l10n/fr.js +++ b/apps/systemtags/l10n/fr.js @@ -7,20 +7,20 @@ OC.L10N.register( "Please select tags to filter by" : "Veuillez sélectionner les étiquettes par lesquelles filtrer", "No files found for the selected tags" : "Aucun fichier pour les étiquettes sélectionnées", "<strong>System tags</strong> for a file have been modified" : "<strong>Les étiquettes systèmes</strong> pour un fichier ont été modifiées", - "You assigned system tag %3$s" : "Vous avez attribué l'étiquette collaborative %3$s", + "You assigned system tag %3$s" : "Vous avez attribué l'étiquette système %3$s", "%1$s assigned system tag %3$s" : "%1$s a attribué l'étiquette système %3$s", - "You unassigned system tag %3$s" : "Vous avez retiré l'étiquette collaborative %3$s", + "You unassigned system tag %3$s" : "Vous avez retiré l'étiquette système %3$s", "%1$s unassigned system tag %3$s" : "%1$s a retiré l'étiquette système %3$s", - "You created system tag %2$s" : "Vous avez créé l'étiquette collaborative %2$s", + "You created system tag %2$s" : "Vous avez créé l'étiquette système %2$s", "%1$s created system tag %2$s" : "%1$s a créé l'étiquette système %2$s", - "You deleted system tag %2$s" : "Vous avez supprimé l'étiquette collaborative %2$s", - "%1$s deleted system tag %2$s" : "%1$s a supprimé l'étiquette collaborative %2$s", - "You updated system tag %3$s to %2$s" : "Vous avez renommé l'étiquette collaborative %3$s en %2$s", - "%1$s updated system tag %3$s to %2$s" : "%1$s a renommé l'étiquette collaborative %3$s en %2$s", - "You assigned system tag %3$s to %2$s" : "Vous avez attribué l'étiquette collaborative %3$s à %2$s", - "%1$s assigned system tag %3$s to %2$s" : "%1$s a attribué l'étiquette collaborative %3$s à %2$s", - "You unassigned system tag %3$s from %2$s" : "Vous avez retiré l'étiquette collaborative %3$s à %2$s", - "%1$s unassigned system tag %3$s from %2$s" : "%1$s a retiré l'étiquette collaborative %3$s à %2$s", + "You deleted system tag %2$s" : "Vous avez supprimé l'étiquette système %2$s", + "%1$s deleted system tag %2$s" : "%1$s a supprimé l'étiquette système %2$s", + "You updated system tag %3$s to %2$s" : "Vous avez renommé l'étiquette système %3$s en %2$s", + "%1$s updated system tag %3$s to %2$s" : "%1$s a renommé l'étiquette système %3$s en %2$s", + "You assigned system tag %3$s to %2$s" : "Vous avez attribué l'étiquette système %3$s à %2$s", + "%1$s assigned system tag %3$s to %2$s" : "%1$s a attribué l'étiquette système %3$s à %2$s", + "You unassigned system tag %3$s from %2$s" : "Vous avez retiré l'étiquette système %3$s de %2$s", + "%1$s unassigned system tag %3$s from %2$s" : "%1$s a retiré l'étiquette système %3$s à %2$s", "%s (restricted)" : "%s (restreint)", "%s (invisible)" : "%s (invisible)", "No files in here" : "Aucun fichier", diff --git a/apps/systemtags/l10n/fr.json b/apps/systemtags/l10n/fr.json index 66b4d246dac..94254c93ab0 100644 --- a/apps/systemtags/l10n/fr.json +++ b/apps/systemtags/l10n/fr.json @@ -5,20 +5,20 @@ "Please select tags to filter by" : "Veuillez sélectionner les étiquettes par lesquelles filtrer", "No files found for the selected tags" : "Aucun fichier pour les étiquettes sélectionnées", "<strong>System tags</strong> for a file have been modified" : "<strong>Les étiquettes systèmes</strong> pour un fichier ont été modifiées", - "You assigned system tag %3$s" : "Vous avez attribué l'étiquette collaborative %3$s", + "You assigned system tag %3$s" : "Vous avez attribué l'étiquette système %3$s", "%1$s assigned system tag %3$s" : "%1$s a attribué l'étiquette système %3$s", - "You unassigned system tag %3$s" : "Vous avez retiré l'étiquette collaborative %3$s", + "You unassigned system tag %3$s" : "Vous avez retiré l'étiquette système %3$s", "%1$s unassigned system tag %3$s" : "%1$s a retiré l'étiquette système %3$s", - "You created system tag %2$s" : "Vous avez créé l'étiquette collaborative %2$s", + "You created system tag %2$s" : "Vous avez créé l'étiquette système %2$s", "%1$s created system tag %2$s" : "%1$s a créé l'étiquette système %2$s", - "You deleted system tag %2$s" : "Vous avez supprimé l'étiquette collaborative %2$s", - "%1$s deleted system tag %2$s" : "%1$s a supprimé l'étiquette collaborative %2$s", - "You updated system tag %3$s to %2$s" : "Vous avez renommé l'étiquette collaborative %3$s en %2$s", - "%1$s updated system tag %3$s to %2$s" : "%1$s a renommé l'étiquette collaborative %3$s en %2$s", - "You assigned system tag %3$s to %2$s" : "Vous avez attribué l'étiquette collaborative %3$s à %2$s", - "%1$s assigned system tag %3$s to %2$s" : "%1$s a attribué l'étiquette collaborative %3$s à %2$s", - "You unassigned system tag %3$s from %2$s" : "Vous avez retiré l'étiquette collaborative %3$s à %2$s", - "%1$s unassigned system tag %3$s from %2$s" : "%1$s a retiré l'étiquette collaborative %3$s à %2$s", + "You deleted system tag %2$s" : "Vous avez supprimé l'étiquette système %2$s", + "%1$s deleted system tag %2$s" : "%1$s a supprimé l'étiquette système %2$s", + "You updated system tag %3$s to %2$s" : "Vous avez renommé l'étiquette système %3$s en %2$s", + "%1$s updated system tag %3$s to %2$s" : "%1$s a renommé l'étiquette système %3$s en %2$s", + "You assigned system tag %3$s to %2$s" : "Vous avez attribué l'étiquette système %3$s à %2$s", + "%1$s assigned system tag %3$s to %2$s" : "%1$s a attribué l'étiquette système %3$s à %2$s", + "You unassigned system tag %3$s from %2$s" : "Vous avez retiré l'étiquette système %3$s de %2$s", + "%1$s unassigned system tag %3$s from %2$s" : "%1$s a retiré l'étiquette système %3$s à %2$s", "%s (restricted)" : "%s (restreint)", "%s (invisible)" : "%s (invisible)", "No files in here" : "Aucun fichier", |