aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/comments/js/commentstabview.js2
-rw-r--r--core/Command/Encryption/ChangeKeyStorageRoot.php6
-rw-r--r--core/css/guest.css9
-rw-r--r--core/css/styles.scss9
-rw-r--r--lib/private/Files/SimpleFS/SimpleFile.php36
-rw-r--r--lib/public/Files/SimpleFS/ISimpleFile.php3
-rw-r--r--settings/css/settings.scss5
-rw-r--r--tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php3
-rw-r--r--tests/lib/Files/SimpleFS/SimpleFileTest.php22
9 files changed, 82 insertions, 13 deletions
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js
index 0ad49163508..9e501b141a7 100644
--- a/apps/comments/js/commentstabview.js
+++ b/apps/comments/js/commentstabview.js
@@ -586,7 +586,7 @@
$submit.prop('disabled', false);
$cancel.prop('disabled', false);
- OC.Notification.showTemporary(t('comments', 'Error occurred while retrieving comment with id {id}', {id: commentId}));
+ OC.Notification.showTemporary(t('comments', 'Error occurred while retrieving comment with ID {id}', {id: commentId}));
}
});
diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php
index 7c6ad5d6126..15e88326973 100644
--- a/core/Command/Encryption/ChangeKeyStorageRoot.php
+++ b/core/Command/Encryption/ChangeKeyStorageRoot.php
@@ -143,11 +143,11 @@ class ChangeKeyStorageRoot extends Command {
$result = $this->rootView->file_put_contents(
$newRoot . '/' . Storage::KEY_STORAGE_MARKER,
- 'ownCloud will detect this folder as key storage root only if this file exists'
+ 'Nextcloud will detect this folder as key storage root only if this file exists'
);
- if ($result === false) {
- throw new \Exception("Can't write to new root folder. Please check the permissions and try again");
+ if (!$result) {
+ throw new \Exception("Can't access the new root folder. Please check the permissions and make sure that the folder is in your data folder");
}
}
diff --git a/core/css/guest.css b/core/css/guest.css
index ecc3da9d081..e0e639252ee 100644
--- a/core/css/guest.css
+++ b/core/css/guest.css
@@ -292,9 +292,12 @@ label.infield {
.strengthify-wrapper {
display: inline-block;
position: relative;
- left: 15px;
- top: -23px;
- width: 250px;
+ left: 5px;
+ top: -20px;
+ width: 269px;
+ border-radius: 0 0 2px 2px;
+ overflow: hidden;
+ height: 3px;
}
.tooltip-inner {
font-weight: bold;
diff --git a/core/css/styles.scss b/core/css/styles.scss
index 4b02041976b..e984707e7d4 100644
--- a/core/css/styles.scss
+++ b/core/css/styles.scss
@@ -448,9 +448,12 @@ body {
.strengthify-wrapper {
display: inline-block;
position: relative;
- left: 15px;
- top: -23px;
- width: 250px;
+ left: 5px;
+ top: -20px;
+ width: 269px;
+ border-radius: 0 0 2px 2px;
+ overflow: hidden;
+ height: 3px;
}
input {
&[type='text'], &[type='password'], &[type='email'] {
diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php
index 5eadfd98b60..1f2b497a192 100644
--- a/lib/private/Files/SimpleFS/SimpleFile.php
+++ b/lib/private/Files/SimpleFS/SimpleFile.php
@@ -23,6 +23,7 @@
namespace OC\Files\SimpleFS;
use OCP\Files\File;
+use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
@@ -79,10 +80,18 @@ class SimpleFile implements ISimpleFile {
/**
* Get the content
*
+ * @throws NotPermittedException
+ * @throws NotFoundException
* @return string
*/
public function getContent() {
- return $this->file->getContent();
+ $result = $this->file->getContent();
+
+ if ($result === false) {
+ $this->checkFile();
+ }
+
+ return $result;
}
/**
@@ -96,6 +105,31 @@ class SimpleFile implements ISimpleFile {
}
/**
+ * Sometimes there are some issues with the AppData. Most of them are from
+ * user error. But we should handle them gracefull anyway.
+ *
+ * If for some reason the current file can't be found. We remove it.
+ * Then traverse up and check all folders if they exists. This so that the
+ * next request will have a valid appdata structure again.
+ *
+ * @throws NotFoundException
+ */
+ private function checkFile() {
+ $cur = $this->file;
+
+ while ($cur->stat() === false) {
+ $parent = $cur->getParent();
+ $cur->delete();
+ $cur = $parent;
+ }
+
+ if ($cur !== $this->file) {
+ throw new NotFoundException('File does not exist');
+ }
+ }
+
+
+ /**
* Delete the file
*
* @throws NotPermittedException
diff --git a/lib/public/Files/SimpleFS/ISimpleFile.php b/lib/public/Files/SimpleFS/ISimpleFile.php
index e9182377cb5..e03509d7abf 100644
--- a/lib/public/Files/SimpleFS/ISimpleFile.php
+++ b/lib/public/Files/SimpleFS/ISimpleFile.php
@@ -22,6 +22,7 @@
*/
namespace OCP\Files\SimpleFS;
+use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
/**
@@ -67,6 +68,8 @@ interface ISimpleFile {
/**
* Get the content
*
+ * @throws NotPermittedException
+ * @throws NotFoundException
* @return string
* @since 11.0.0
*/
diff --git a/settings/css/settings.scss b/settings/css/settings.scss
index 006a0697984..21dc76fcac3 100644
--- a/settings/css/settings.scss
+++ b/settings/css/settings.scss
@@ -1159,8 +1159,11 @@ span {
#passwordform .strengthify-wrapper {
position: absolute;
left: 0;
- width: 130px;
+ width: 100%;
+ border-radius: 0 0 2px 2px;
margin-top: -6px;
+ overflow: hidden;
+ height: 3px;
}
/* OPERA hack for strengthify*/
diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
index 57eb2137ac1..4ecea745cfa 100644
--- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
+++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
@@ -175,7 +175,7 @@ class ChangeKeyStorageRootTest extends TestCase {
$this->view->expects($this->once())->method('file_put_contents')
->with('newRoot/' . \OC\Encryption\Keys\Storage::KEY_STORAGE_MARKER,
- 'ownCloud will detect this folder as key storage root only if this file exists');
+ 'Nextcloud will detect this folder as key storage root only if this file exists')->willReturn(true);
$this->invokePrivate($this->changeKeyStorageRoot, 'prepareNewRoot', ['newRoot']);
}
@@ -198,6 +198,7 @@ class ChangeKeyStorageRootTest extends TestCase {
public function dataTestPrepareNewRootException() {
return [
[true, false],
+ [true, null],
[false, true]
];
}
diff --git a/tests/lib/Files/SimpleFS/SimpleFileTest.php b/tests/lib/Files/SimpleFS/SimpleFileTest.php
index 4e623eafa22..ab4970804a4 100644
--- a/tests/lib/Files/SimpleFS/SimpleFileTest.php
+++ b/tests/lib/Files/SimpleFS/SimpleFileTest.php
@@ -24,6 +24,9 @@ namespace Test\File\SimpleFS;
use OC\Files\SimpleFS\SimpleFile;
use OCP\Files\File;
+use OCP\Files\Folder;
+use OCP\Files\NotFoundException;
+use OCP\Files\NotPermittedException;
class SimpleFileTest extends \Test\TestCase {
/** @var File|\PHPUnit_Framework_MockObject_MockObject */
@@ -101,4 +104,23 @@ class SimpleFileTest extends \Test\TestCase {
$this->assertEquals('app/awesome', $this->simpleFile->getMimeType());
}
+
+ public function testGetContentInvalidAppData() {
+ $this->file->method('getContent')
+ ->willReturn(false);
+ $this->file->method('stat')->willReturn(false);
+
+ $parent = $this->createMock(Folder::class);
+ $parent->method('stat')->willReturn(false);
+
+ $root = $this->createMock(Folder::class);
+ $root->method('stat')->willReturn([]);
+
+ $this->file->method('getParent')->willReturn($parent);
+ $parent->method('getParent')->willReturn($root);
+
+ $this->expectException(NotFoundException::class);
+
+ $this->simpleFile->getContent();
+ }
}