diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-06-09 18:45:12 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-06-09 18:45:12 +0200 |
commit | a636e4ff28b25797d6cc7750bc1efe52437ec67f (patch) | |
tree | ef385b9ef924088b6d6c1404d659e6be450aaf1f /apps | |
parent | 28193732ea24094335cccddf5fe03aeeeb6f5894 (diff) | |
parent | 6ba18934e6f095de08bec7bdc10c45485eeb5cc7 (diff) | |
download | nextcloud-server-a636e4ff28b25797d6cc7750bc1efe52437ec67f.tar.gz nextcloud-server-a636e4ff28b25797d6cc7750bc1efe52437ec67f.zip |
Downstream 2016-06-09
Merge branch 'master' of https://github.com/owncloud/core into downstream-160609
Diffstat (limited to 'apps')
46 files changed, 318 insertions, 131 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 7b959a0d899..27900cc1cad 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -110,10 +110,10 @@ class Auth extends AbstractBasic { $this->session->close(); return true; } else { - \OC_Util::setUpFS(); //login hooks may need early access to the filesystem + \OC_Util::setupFS(); //login hooks may need early access to the filesystem if($this->userSession->logClientIn($username, $password)) { $this->userSession->createSessionToken($this->request, $this->userSession->getUser()->getUID(), $username, $password); - \OC_Util::setUpFS($this->userSession->getUser()->getUID()); + \OC_Util::setupFS($this->userSession->getUser()->getUID()); $this->session->set(self::DAV_AUTHENTICATED, $this->userSession->getUser()->getUID()); $this->session->close(); return true; diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index e7226b58196..ddab34605f3 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -196,6 +196,8 @@ 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 a4e13709559..dc47416cca8 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -168,20 +168,19 @@ class FilesPlugin extends ServerPlugin { */ 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"); } } diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 04640bbde4f..c41b5137fde 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -347,4 +347,8 @@ 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 599f3fdfd0e..9e7d876187d 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -161,6 +161,8 @@ 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 87fec17bf6b..80f284e470e 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -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; @@ -36,16 +37,16 @@ use Test\TestCase; * 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 @@ -58,7 +59,7 @@ class FilesPluginTest extends TestCase { private $tree; /** - * @var \OCA\DAV\Connector\Sabre\FilesPlugin + * @var FilesPlugin */ private $plugin; @@ -84,11 +85,11 @@ class FilesPluginTest extends TestCase { ->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 @@ -263,7 +264,7 @@ class FilesPluginTest extends TestCase { } public function testGetPublicPermissions() { - $this->plugin = new \OCA\DAV\Connector\Sabre\FilesPlugin( + $this->plugin = new FilesPlugin( $this->tree, $this->view, $this->config, @@ -331,7 +332,7 @@ class FilesPluginTest extends TestCase { $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory') ->disableOriginalConstructor() ->getMock(); - $node->method('getPath')->willReturn('/'); + $node->expects($this->any())->method('getPath')->willReturn('/'); $propFind = new PropFind( '/', @@ -432,11 +433,16 @@ class FilesPluginTest extends TestCase { ->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'); } @@ -448,11 +454,16 @@ class FilesPluginTest extends TestCase { ->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'); } @@ -461,10 +472,15 @@ class FilesPluginTest extends TestCase { * @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'); } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php new file mode 100644 index 00000000000..4f481cba557 --- /dev/null +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php @@ -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')); + } +} diff --git a/apps/federatedfilesharing/l10n/ar.js b/apps/federatedfilesharing/l10n/ar.js new file mode 100644 index 00000000000..451663a7b6b --- /dev/null +++ b/apps/federatedfilesharing/l10n/ar.js @@ -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;"); diff --git a/apps/federatedfilesharing/l10n/ar.json b/apps/federatedfilesharing/l10n/ar.json new file mode 100644 index 00000000000..630ab95f64b --- /dev/null +++ b/apps/federatedfilesharing/l10n/ar.json @@ -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;" +}
\ No newline at end of file diff --git a/apps/federatedfilesharing/l10n/pl.js b/apps/federatedfilesharing/l10n/pl.js index 9bd5edd9b56..1d8b949c74a 100644 --- a/apps/federatedfilesharing/l10n/pl.js +++ b/apps/federatedfilesharing/l10n/pl.js @@ -2,6 +2,7 @@ OC.L10N.register( "federatedfilesharing", { "Sharing %s failed, because this item is already shared with %s" : "Współdzielenie %s nie powiodło się, ponieważ element jest już współdzielony z %s", + "File is already shared with %s" : "Plik jest już współdzielony z %s", "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "Współdzielenie %s nie powiodło się, nie można odnaleźć %s. Prawdopobnie serwer nie jest teraz osiągalny.", "Accept" : "Akceptuj", "Open documentation" : "Otwórz dokumentację", diff --git a/apps/federatedfilesharing/l10n/pl.json b/apps/federatedfilesharing/l10n/pl.json index 5fd8fb130b7..c44eecbeeb7 100644 --- a/apps/federatedfilesharing/l10n/pl.json +++ b/apps/federatedfilesharing/l10n/pl.json @@ -1,5 +1,6 @@ { "translations": { "Sharing %s failed, because this item is already shared with %s" : "Współdzielenie %s nie powiodło się, ponieważ element jest już współdzielony z %s", + "File is already shared with %s" : "Plik jest już współdzielony z %s", "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "Współdzielenie %s nie powiodło się, nie można odnaleźć %s. Prawdopobnie serwer nie jest teraz osiągalny.", "Accept" : "Akceptuj", "Open documentation" : "Otwórz dokumentację", diff --git a/apps/federation/css/settings-admin.css b/apps/federation/css/settings-admin.css index 55b1dd64d15..150412c156f 100644 --- a/apps/federation/css/settings-admin.css +++ b/apps/federation/css/settings-admin.css @@ -17,10 +17,13 @@ cursor: pointer; } -#listOfTrustedServers li:hover { - cursor: pointer; -} - #listOfTrustedServers .status { margin-right: 10px; } + +#listOfTrustedServers .icon { + cursor: pointer; + display: inline-block; + vertical-align: middle; + margin-left: 10px; +} diff --git a/apps/federation/js/settings-admin.js b/apps/federation/js/settings-admin.js index 7d531b39d8c..45d5d62a5a3 100644 --- a/apps/federation/js/settings-admin.js +++ b/apps/federation/js/settings-admin.js @@ -42,8 +42,9 @@ $(document).ready(function () { $('ul#listOfTrustedServers').prepend( $('<li>') .attr('id', data.id) - .attr('class', 'icon-delete') - .html('<span class="status indeterminate"></span>' + data.url) + .html('<span class="status indeterminate"></span>' + + data.url + + '<span class="icon icon-delete"></span>') ); OC.msg.finishedSuccess('#ocFederationAddServer .msg', data.message); }) @@ -56,10 +57,10 @@ $(document).ready(function () { } }); - // remove trusted server from list - $( "#listOfTrustedServers" ).on('click', 'li', function() { - var id = $(this).attr('id'); - var $this = $(this); +// remove trusted server from list + $( "#listOfTrustedServers" ).on('click', 'li > .icon-delete', function() { + var $this = $(this).parent(); + id = $this.attr('id'); $.ajax({ url: OC.generateUrl('/apps/federation/trusted-servers/' + id), type: 'DELETE', diff --git a/apps/federation/templates/settings-admin.php b/apps/federation/templates/settings-admin.php index 704fc9a9ace..ce66214de7c 100644 --- a/apps/federation/templates/settings-admin.php +++ b/apps/federation/templates/settings-admin.php @@ -23,7 +23,7 @@ style('federation', 'settings-admin') </p> <ul id="listOfTrustedServers"> <?php foreach($_['trustedServers'] as $trustedServer) { ?> - <li id="<?php p($trustedServer['id']); ?>" class="icon-delete"> + <li id="<?php p($trustedServer['id']); ?>"> <?php if((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> <span class="status success"></span> <?php @@ -36,6 +36,7 @@ style('federation', 'settings-admin') <span class="status error"></span> <?php } ?> <?php p($trustedServer['url']); ?> + <span class="icon icon-delete"></span> </li> <?php } ?> </ul> diff --git a/apps/files/js/app.js b/apps/files/js/app.js index 7a3d78f9663..fbfa510e07e 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -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 diff --git a/apps/files/l10n/da.js b/apps/files/l10n/da.js index e1013bcafbb..e585ccacc1c 100644 --- a/apps/files/l10n/da.js +++ b/apps/files/l10n/da.js @@ -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", @@ -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", @@ -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", @@ -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!", diff --git a/apps/files/l10n/da.json b/apps/files/l10n/da.json index 3162770cc40..499533d77ba 100644 --- a/apps/files/l10n/da.json +++ b/apps/files/l10n/da.json @@ -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", @@ -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", @@ -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", @@ -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!", diff --git a/apps/files/l10n/pl.js b/apps/files/l10n/pl.js index 01259a538ab..cb243f6bf4d 100644 --- a/apps/files/l10n/pl.js +++ b/apps/files/l10n/pl.js @@ -45,6 +45,7 @@ OC.L10N.register( "Unable to determine date" : "Nie można ustalić daty", "This operation is forbidden" : "Ta operacja jest niedozwolona", "This directory is unavailable, please check the logs or contact the administrator" : "Ten folder jest niedostępny, proszę sprawdzić logi lub skontaktować się z administratorem.", + "Could not move \"{file}\", target exists" : "Nie można było przenieść „{file}” – plik o takiej nazwie już istnieje", "Could not move \"{file}\"" : "Nie można było przenieść \"{file}\"", "Could not create file \"{file}\"" : "Nie można było utworzyć pliku \"{file}\"", "Could not create file \"{file}\" because it already exists" : "Nie można było utworzyć pliku \"{file}\", ponieważ ten plik już istnieje.", diff --git a/apps/files/l10n/pl.json b/apps/files/l10n/pl.json index fd4d5116953..60323d0e757 100644 --- a/apps/files/l10n/pl.json +++ b/apps/files/l10n/pl.json @@ -43,6 +43,7 @@ "Unable to determine date" : "Nie można ustalić daty", "This operation is forbidden" : "Ta operacja jest niedozwolona", "This directory is unavailable, please check the logs or contact the administrator" : "Ten folder jest niedostępny, proszę sprawdzić logi lub skontaktować się z administratorem.", + "Could not move \"{file}\", target exists" : "Nie można było przenieść „{file}” – plik o takiej nazwie już istnieje", "Could not move \"{file}\"" : "Nie można było przenieść \"{file}\"", "Could not create file \"{file}\"" : "Nie można było utworzyć pliku \"{file}\"", "Could not create file \"{file}\" because it already exists" : "Nie można było utworzyć pliku \"{file}\", ponieważ ten plik już istnieje.", diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 1b0903b41d3..18b6cf719c5 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,7 +37,6 @@ 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; @@ -142,11 +141,15 @@ 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) { - return $this->showFile($fileid); + try { + return $this->showFile($fileid); + } catch (NotFoundException $e) { + $fileNotFound = true; + } } $nav = new \OCP\Template('files', 'appnavigation', ''); @@ -245,6 +248,7 @@ 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'); @@ -265,40 +269,37 @@ class ViewController extends Controller { * Redirects to the file list and highlight the given file id * * @param string $fileId file id to show - * @return Response redirect response or not found response + * @return RedirectResponse redirect response or not found response + * @throws \OCP\Files\NotFoundException * * @NoCSRFRequired * @NoAdminRequired */ public function showFile($fileId) { - try { - $uid = $this->userSession->getUser()->getUID(); - $baseFolder = $this->rootFolder->get($uid . '/files/'); - $files = $baseFolder->getById($fileId); - $params = []; + $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/'); - $files = $baseFolder->getById($fileId); - $params['view'] = 'trashbin'; - } + 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(); - } - return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params)); + 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(); } - } catch (\OCP\Files\NotFoundException $e) { - return new NotFoundResponse(); + return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params)); } - return new NotFoundResponse(); + throw new \OCP\Files\NotFoundException(); } } diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 7281edd3aec..42ce941a4a5 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -14,6 +14,7 @@ <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 049f44fc0af..34c40ecea5c 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -26,6 +26,7 @@ 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; @@ -259,7 +260,8 @@ class ViewControllerTest extends TestCase { 'isPublic' => false, 'defaultFileSorting' => 'name', 'defaultFileSortingDirection' => 'asc', - 'showHiddenFiles' => false, + 'showHiddenFiles' => 0, + 'fileNotFound' => 0, 'mailNotificationEnabled' => 'no', 'mailPublicNotificationEnabled' => 'no', 'allowShareWithLink' => 'yes', @@ -410,11 +412,14 @@ class ViewControllerTest extends TestCase { ->with(123) ->will($this->returnValue([])); - $expected = new Http\NotFoundResponse(); if ($useShowFile) { - $this->assertEquals($expected, $this->viewController->showFile(123)); + $this->setExpectedException('OCP\Files\NotFoundException'); + $this->viewController->showFile(123); } else { - $this->assertEquals($expected, $this->viewController->index('/whatever', '', '123')); + $response = $this->viewController->index('MyDir', 'MyView', '123'); + $this->assertInstanceOf('OCP\AppFramework\Http\TemplateResponse', $response); + $params = $response->getParams(); + $this->assertEquals(1, $params['fileNotFound']); } } diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 8d2cb52d67c..2477f513db3 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -299,7 +299,8 @@ StorageConfig.prototype = { mountPoint: this.mountPoint, backend: this.backend, authMechanism: this.authMechanism, - backendOptions: this.backendOptions + backendOptions: this.backendOptions, + testOnly: true }; if (this.id) { data.id = this.id; @@ -326,6 +327,7 @@ StorageConfig.prototype = { $.ajax({ type: 'GET', url: OC.generateUrl(this._url + '/{id}', {id: this.id}), + data: {'testOnly': true}, success: options.success, error: options.error }); @@ -908,6 +910,7 @@ MountConfigListView.prototype = _.extend({ $.ajax({ type: 'GET', url: OC.generateUrl('apps/files_external/userglobalstorages'), + data: {'testOnly' : true}, contentType: 'application/json', success: function(result) { var onCompletion = jQuery.Deferred(); diff --git a/apps/files_external/js/statusmanager.js b/apps/files_external/js/statusmanager.js index 118ec17d246..91974f2d04d 100644 --- a/apps/files_external/js/statusmanager.js +++ b/apps/files_external/js/statusmanager.js @@ -78,6 +78,7 @@ OCA.External.StatusManager = { defObj = $.ajax({ type: 'GET', url: OC.webroot + '/index.php/apps/files_external/' + ((mountData.type === 'personal') ? 'userstorages' : 'userglobalstorages') + '/' + mountData.id, + data: {'testOnly' : false}, success: function (response) { if (response && response.status === 0) { self.mountStatus[mountData.mount_point] = response; diff --git a/apps/files_external/l10n/pl.js b/apps/files_external/l10n/pl.js index 0ba2646601b..8c3e394627e 100644 --- a/apps/files_external/l10n/pl.js +++ b/apps/files_external/l10n/pl.js @@ -2,6 +2,7 @@ OC.L10N.register( "files_external", { "Fetching access tokens failed. Verify that your app key and secret are correct." : "Otrzymano błędne żądanie tokenów. Sprawdź, czy klucz aplikacji oraz klucz poufny są poprawne.", + "Please provide a valid app key and secret." : "Proszę podać prawidłowy klucz aplikacji i klucz sekretny.", "Step 1 failed. Exception: %s" : "Krok 1 błędny. Błąd: %s", "Step 2 failed. Exception: %s" : "Krok 2 błędny. Błąd: %s", "External storage" : "Zewnętrzne zasoby dyskowe", diff --git a/apps/files_external/l10n/pl.json b/apps/files_external/l10n/pl.json index 8809813c9ba..8e00fc31863 100644 --- a/apps/files_external/l10n/pl.json +++ b/apps/files_external/l10n/pl.json @@ -1,5 +1,6 @@ { "translations": { "Fetching access tokens failed. Verify that your app key and secret are correct." : "Otrzymano błędne żądanie tokenów. Sprawdź, czy klucz aplikacji oraz klucz poufny są poprawne.", + "Please provide a valid app key and secret." : "Proszę podać prawidłowy klucz aplikacji i klucz sekretny.", "Step 1 failed. Exception: %s" : "Krok 1 błędny. Błąd: %s", "Step 2 failed. Exception: %s" : "Krok 2 błędny. Błąd: %s", "External storage" : "Zewnętrzne zasoby dyskowe", diff --git a/apps/files_external/l10n/pt_PT.js b/apps/files_external/l10n/pt_PT.js index 9d3998d903b..68f183a36b3 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 app Dropbox", - "Google Drive App Configuration" : "Configuração da app Google Drive", + "Dropbox App Configuration" : "Configuração da aplicação Dropbox", + "Google Drive App Configuration" : "Configuração da aplicação Google Drive", "Personal" : "Pessoal", "System" : "Sistema", "Grant access" : "Conceder acesso", - "Error configuring OAuth1" : "Erro de configuração OAuth1", - "Error configuring OAuth2" : "Erro de configuração OAuth2", + "Error configuring OAuth1" : "Erro ao configurar OAuth1", + "Error configuring OAuth2" : "Erro ao configurar 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 salvar credenciais", + "Credentials saving failed" : "Falha ao guardar as 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" : "Código de acesso", + "Access key" : "Chave 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 fab0f05a830..93922c67762 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 app Dropbox", - "Google Drive App Configuration" : "Configuração da app Google Drive", + "Dropbox App Configuration" : "Configuração da aplicação Dropbox", + "Google Drive App Configuration" : "Configuração da aplicação Google Drive", "Personal" : "Pessoal", "System" : "Sistema", "Grant access" : "Conceder acesso", - "Error configuring OAuth1" : "Erro de configuração OAuth1", - "Error configuring OAuth2" : "Erro de configuração OAuth2", + "Error configuring OAuth1" : "Erro ao configurar OAuth1", + "Error configuring OAuth2" : "Erro ao configurar 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 salvar credenciais", + "Credentials saving failed" : "Falha ao guardar as 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" : "Código de acesso", + "Access key" : "Chave de acesso", "Secret key" : "Código secreto", "Builtin" : "Integrado", "None" : "Nenhum", diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php index 6f9278ce6f1..471e3b51593 100644 --- a/apps/files_external/lib/Controller/GlobalStoragesController.php +++ b/apps/files_external/lib/Controller/GlobalStoragesController.php @@ -139,7 +139,8 @@ class GlobalStoragesController extends StoragesController { $mountOptions, $applicableUsers, $applicableGroups, - $priority + $priority, + $testOnly = true ) { $storage = $this->createStorage( $mountPoint, @@ -172,7 +173,7 @@ class GlobalStoragesController extends StoragesController { ); } - $this->updateStorageStatus($storage); + $this->updateStorageStatus($storage, $testOnly); return new DataResponse( $storage, diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php index aa6a04ecb8d..e50426f4888 100644 --- a/apps/files_external/lib/Controller/StoragesController.php +++ b/apps/files_external/lib/Controller/StoragesController.php @@ -238,7 +238,7 @@ abstract class StoragesController extends Controller { * * @param StorageConfig $storage storage configuration */ - protected function updateStorageStatus(StorageConfig &$storage) { + protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true) { try { $this->manipulateStorageConfig($storage); @@ -249,7 +249,8 @@ abstract class StoragesController extends Controller { \OC_Mount_Config::getBackendStatus( $backend->getStorageClass(), $storage->getBackendOptions(), - false + false, + $testOnly ) ); } catch (InsufficientDataForMeaningfulAnswerException $e) { @@ -293,11 +294,11 @@ abstract class StoragesController extends Controller { * * @return DataResponse */ - public function show($id) { + public function show($id, $testOnly = true) { try { $storage = $this->service->getStorage($id); - $this->updateStorageStatus($storage); + $this->updateStorageStatus($storage, $testOnly); } catch (NotFoundException $e) { return new DataResponse( [ diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php index 1c94a1e9635..f65e578507d 100644 --- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php +++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php @@ -111,11 +111,11 @@ class UserGlobalStoragesController extends StoragesController { * * @NoAdminRequired */ - public function show($id) { + public function show($id, $testOnly = true) { try { $storage = $this->service->getStorage($id); - $this->updateStorageStatus($storage); + $this->updateStorageStatus($storage, $testOnly); } catch (NotFoundException $e) { return new DataResponse( [ @@ -146,7 +146,8 @@ class UserGlobalStoragesController extends StoragesController { */ public function update( $id, - $backendOptions + $backendOptions, + $testOnly = true ) { try { $storage = $this->service->getStorage($id); @@ -171,7 +172,7 @@ class UserGlobalStoragesController extends StoragesController { ); } - $this->updateStorageStatus($storage); + $this->updateStorageStatus($storage, $testOnly); $this->sanitizeStorage($storage); return new DataResponse( diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index 936da7ec5e2..28663090e89 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -101,8 +101,8 @@ class UserStoragesController extends StoragesController { * * {@inheritdoc} */ - public function show($id) { - return parent::show($id); + public function show($id, $testOnly = true) { + return parent::show($id, $testOnly); } /** @@ -170,7 +170,8 @@ class UserStoragesController extends StoragesController { $backend, $authMechanism, $backendOptions, - $mountOptions + $mountOptions, + $testOnly = true ) { $storage = $this->createStorage( $mountPoint, @@ -200,7 +201,7 @@ class UserStoragesController extends StoragesController { ); } - $this->updateStorageStatus($storage); + $this->updateStorageStatus($storage, $testOnly); return new DataResponse( $storage, diff --git a/apps/files_external/lib/Lib/Storage/Google.php b/apps/files_external/lib/Lib/Storage/Google.php index 2a1ff768e2c..96f12800c10 100644 --- a/apps/files_external/lib/Lib/Storage/Google.php +++ b/apps/files_external/lib/Lib/Storage/Google.php @@ -97,6 +97,9 @@ 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 === '') { @@ -138,7 +141,7 @@ class Google extends \OC\Files\Storage\Common { if ($pos !== false) { $pathWithoutExt = substr($path, 0, $pos); $file = $this->getDriveFile($pathWithoutExt); - if ($file) { + if ($file && $this->isGoogleDocFile($file)) { // Switch cached Google_Service_Drive_DriveFile to the correct index unset($this->driveFiles[$pathWithoutExt]); $this->driveFiles[$path] = $file; @@ -208,6 +211,17 @@ 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)); @@ -312,7 +326,7 @@ class Google extends \OC\Files\Storage\Common { $stat['size'] = 0; } else { // Check if this is a Google Doc - if ($this->getMimeType($path) !== $file->getMimeType()) { + if ($this->isGoogleDocFile($file)) { // Return unknown file size $stat['size'] = \OCP\Files\FileInfo::SPACE_UNKNOWN; } else { diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 86aafcf5770..3510b675d4d 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -215,7 +215,7 @@ class OC_Mount_Config { * @return int see self::STATUS_* * @throws Exception */ - public static function getBackendStatus($class, $options, $isPersonal) { + public static function getBackendStatus($class, $options, $isPersonal, $testOnly = true) { if (self::$skipTest) { return StorageNotAvailableException::STATUS_SUCCESS; } @@ -228,7 +228,7 @@ class OC_Mount_Config { $storage = new $class($options); try { - $result = $storage->test($isPersonal); + $result = $storage->test($isPersonal, $testOnly); $storage->setAvailability($result); if ($result) { return StorageNotAvailableException::STATUS_SUCCESS; diff --git a/apps/files_external/tests/Storage/GoogleTest.php b/apps/files_external/tests/Storage/GoogleTest.php index 7684fec8429..eb19cc463b1 100644 --- a/apps/files_external/tests/Storage/GoogleTest.php +++ b/apps/files_external/tests/Storage/GoogleTest.php @@ -60,4 +60,13 @@ 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_external/tests/js/settingsSpec.js b/apps/files_external/tests/js/settingsSpec.js index 7aa49b2c82a..8f01c16b38c 100644 --- a/apps/files_external/tests/js/settingsSpec.js +++ b/apps/files_external/tests/js/settingsSpec.js @@ -223,7 +223,8 @@ describe('OCA.External.Settings tests', function() { applicableGroups: [], mountOptions: { 'previews': true - } + }, + testOnly: true }); // TODO: respond and check data-id diff --git a/apps/files_sharing/l10n/pl.js b/apps/files_sharing/l10n/pl.js index a703ef087ee..ebdfe2aa738 100644 --- a/apps/files_sharing/l10n/pl.js +++ b/apps/files_sharing/l10n/pl.js @@ -21,6 +21,7 @@ OC.L10N.register( "Remote share password" : "Hasło do zdalnego zasobu", "Cancel" : "Anuluj", "Add remote share" : "Dodaj zdalny zasób", + "No ownCloud installation (7 or higher) found at {remote}" : "Nie znaleziono instalacji ownCloud (w wersji 7 lub nowszej) na {remote}", "Invalid ownCloud url" : "Błędny adres URL", "Shared by" : "Udostępniane przez", "Sharing" : "Udostępnianie", diff --git a/apps/files_sharing/l10n/pl.json b/apps/files_sharing/l10n/pl.json index 62d6ef25b38..f5de5dd368c 100644 --- a/apps/files_sharing/l10n/pl.json +++ b/apps/files_sharing/l10n/pl.json @@ -19,6 +19,7 @@ "Remote share password" : "Hasło do zdalnego zasobu", "Cancel" : "Anuluj", "Add remote share" : "Dodaj zdalny zasób", + "No ownCloud installation (7 or higher) found at {remote}" : "Nie znaleziono instalacji ownCloud (w wersji 7 lub nowszej) na {remote}", "Invalid ownCloud url" : "Błędny adres URL", "Shared by" : "Udostępniane przez", "Sharing" : "Udostępnianie", diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index 82d885a8ef3..a0519cadbaa 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 = $entry['path']; + $path = isset($entry['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 965c4d36cad..b5b5e416884 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -415,4 +415,22 @@ 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 93c7d364b24..387bc45643c 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 système %3$s", + "You assigned system tag %3$s" : "Vous avez attribué l'étiquette collaborative %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 système %3$s", + "You unassigned system tag %3$s" : "Vous avez retiré l'étiquette collaborative %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 système %2$s", + "You created system tag %2$s" : "Vous avez créé l'étiquette collaborative %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 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", + "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", "%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 94254c93ab0..66b4d246dac 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 système %3$s", + "You assigned system tag %3$s" : "Vous avez attribué l'étiquette collaborative %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 système %3$s", + "You unassigned system tag %3$s" : "Vous avez retiré l'étiquette collaborative %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 système %2$s", + "You created system tag %2$s" : "Vous avez créé l'étiquette collaborative %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 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", + "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", "%s (restricted)" : "%s (restreint)", "%s (invisible)" : "%s (invisible)", "No files in here" : "Aucun fichier", diff --git a/apps/systemtags/l10n/pl.js b/apps/systemtags/l10n/pl.js index fc3616bff26..f5e4775d540 100644 --- a/apps/systemtags/l10n/pl.js +++ b/apps/systemtags/l10n/pl.js @@ -3,6 +3,8 @@ OC.L10N.register( { "Tags" : "Etykiety", "Tagged files" : "Otagowane pliki", + "Select tags to filter by" : "Wybierz tagi do filtru", + "Please select tags to filter by" : "Proszę wybrać tagi do filtrów", "No files found for the selected tags" : "Nie znaleziono plików dla wybranych etykiet", "<strong>System tags</strong> for a file have been modified" : "<strong>System etykiet</strong> dla pliku został zmieniony", "%1$s assigned system tag %3$s" : "%1$s przypisywalny system etykiet%3$s", diff --git a/apps/systemtags/l10n/pl.json b/apps/systemtags/l10n/pl.json index 543aa3be58c..6cb103ed4a5 100644 --- a/apps/systemtags/l10n/pl.json +++ b/apps/systemtags/l10n/pl.json @@ -1,6 +1,8 @@ { "translations": { "Tags" : "Etykiety", "Tagged files" : "Otagowane pliki", + "Select tags to filter by" : "Wybierz tagi do filtru", + "Please select tags to filter by" : "Proszę wybrać tagi do filtrów", "No files found for the selected tags" : "Nie znaleziono plików dla wybranych etykiet", "<strong>System tags</strong> for a file have been modified" : "<strong>System etykiet</strong> dla pliku został zmieniony", "%1$s assigned system tag %3$s" : "%1$s przypisywalny system etykiet%3$s", diff --git a/apps/updatenotification/l10n/pl.js b/apps/updatenotification/l10n/pl.js index 6551d0808e3..d86fdf3c243 100644 --- a/apps/updatenotification/l10n/pl.js +++ b/apps/updatenotification/l10n/pl.js @@ -1,8 +1,11 @@ OC.L10N.register( "updatenotification", { + "Update notifications" : "Powiadomienia o aktualizacji", "{version} is available. Get more information on how to update." : "Wersja {version} jest dostępna. Dowiedz się jak zaktualizować.", "Updated channel" : "Zaktualizowano kanał", + "ownCloud core" : "Rdzeń ownCloud", + "Update for %1$s to version %2$s is available." : "Jest dostępna aktualizacja dla %1$s do wersji %2$s", "Updater" : "Aktualizator", "A new version is available: %s" : "Dostępna jest nowa wersja: %s", "Open updater" : "Otwórz aktualizator", diff --git a/apps/updatenotification/l10n/pl.json b/apps/updatenotification/l10n/pl.json index fd859feae11..b5d7132d9f0 100644 --- a/apps/updatenotification/l10n/pl.json +++ b/apps/updatenotification/l10n/pl.json @@ -1,6 +1,9 @@ { "translations": { + "Update notifications" : "Powiadomienia o aktualizacji", "{version} is available. Get more information on how to update." : "Wersja {version} jest dostępna. Dowiedz się jak zaktualizować.", "Updated channel" : "Zaktualizowano kanał", + "ownCloud core" : "Rdzeń ownCloud", + "Update for %1$s to version %2$s is available." : "Jest dostępna aktualizacja dla %1$s do wersji %2$s", "Updater" : "Aktualizator", "A new version is available: %s" : "Dostępna jest nowa wersja: %s", "Open updater" : "Otwórz aktualizator", |