aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_encryption/appinfo/version2
-rw-r--r--apps/provisioning_api/appinfo/info.xml4
-rw-r--r--lib/private/connector/sabre/file.php6
-rw-r--r--lib/private/files/cache/cache.php3
-rw-r--r--lib/private/files/cache/homecache.php1
-rw-r--r--lib/private/files/filesystem.php2
-rw-r--r--lib/private/share/share.php1
-rw-r--r--tests/lib/connector/sabre/file.php25
-rw-r--r--tests/lib/files/view.php16
9 files changed, 55 insertions, 5 deletions
diff --git a/apps/files_encryption/appinfo/version b/apps/files_encryption/appinfo/version
index faef31a4357..39e898a4f95 100644
--- a/apps/files_encryption/appinfo/version
+++ b/apps/files_encryption/appinfo/version
@@ -1 +1 @@
-0.7.0
+0.7.1
diff --git a/apps/provisioning_api/appinfo/info.xml b/apps/provisioning_api/appinfo/info.xml
index 3f1fa745cf5..7c662c18c09 100644
--- a/apps/provisioning_api/appinfo/info.xml
+++ b/apps/provisioning_api/appinfo/info.xml
@@ -19,4 +19,8 @@
<documentation>
<admin>admin-provisioning-api</admin>
</documentation>
+ <types>
+ <!-- this is used to disable the feature of enabling an app for specific groups only because this would break this app -->
+ <filesystem/>
+ </types>
</info>
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index 0f5a3315f8f..12ce633838f 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -64,7 +64,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
throw new \Sabre\DAV\Exception\ServiceUnavailable("Encryption is disabled");
}
- $fileName = basename($this->path);
+ $fileName = basename($this->info->getPath());
if (!\OCP\Util::isValidFileName($fileName)) {
throw new \Sabre\DAV\Exception\BadRequest();
}
@@ -74,8 +74,8 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
return $this->createFileChunked($data);
}
- list($storage, ) = $this->fileView->resolvePath($this->path);
- $needsPartFile = $this->needsPartFile($storage);
+ list($storage,) = $this->fileView->resolvePath($this->path);
+ $needsPartFile = $this->needsPartFile($storage) && (strlen($this->path) > 1);
if ($needsPartFile) {
// mark file as partial while uploading (ignored by the scanner)
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 8831320bcee..5438bdad5cb 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -596,6 +596,7 @@ class Cache {
'WHERE `parent` = ? AND `storage` = ?';
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
if ($row = $result->fetchRow()) {
+ $result->closeCursor();
list($sum, $min, $unencryptedSum) = array_values($row);
$sum = 0 + $sum;
$min = 0 + $min;
@@ -618,6 +619,8 @@ class Cache {
if ($totalSize !== -1 and $unencryptedSum > 0) {
$totalSize = $unencryptedSum;
}
+ } else {
+ $result->closeCursor();
}
}
return $totalSize;
diff --git a/lib/private/files/cache/homecache.php b/lib/private/files/cache/homecache.php
index 2b3967c8807..ad7f587b8b6 100644
--- a/lib/private/files/cache/homecache.php
+++ b/lib/private/files/cache/homecache.php
@@ -35,6 +35,7 @@ class HomeCache extends Cache {
'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
if ($row = $result->fetchRow()) {
+ $result->closeCursor();
list($sum, $unencryptedSum) = array_values($row);
$totalSize = 0 + $sum;
$unencryptedSize = 0 + $unencryptedSum;
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index c460159ece3..140d892652f 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -293,7 +293,7 @@ class Filesystem {
}
$mount = self::$mounts->find($path);
if ($mount) {
- return array($mount->getStorage(), $mount->getInternalPath($path));
+ return array($mount->getStorage(), rtrim($mount->getInternalPath($path), '/'));
} else {
return array(null, null);
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index c9f9654203e..b2c84e39044 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -706,6 +706,7 @@ class Share extends \OC\Share\Constants {
$token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER .
\OCP\Security\ISecureRandom::CHAR_DIGITS);
+ $shareWith = rtrim($shareWith, '/');
$shareId = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, null, $token, $itemSourceName);
$send = false;
diff --git a/tests/lib/connector/sabre/file.php b/tests/lib/connector/sabre/file.php
index 6bb1b4e75d1..33dc78f87d8 100644
--- a/tests/lib/connector/sabre/file.php
+++ b/tests/lib/connector/sabre/file.php
@@ -32,6 +32,31 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase {
$file->put('test data');
}
+ public function testPutSingleFileShare() {
+ // setup
+ $storage = $this->getMock('\OCP\Files\Storage');
+ $view = $this->getMock('\OC\Files\View', array('file_put_contents', 'getRelativePath'), array());
+ $view->expects($this->any())
+ ->method('resolvePath')
+ ->with('')
+ ->will($this->returnValue(array($storage, '')));
+ $view->expects($this->any())
+ ->method('getRelativePath')
+ ->will($this->returnValue(''));
+ $view->expects($this->any())
+ ->method('file_put_contents')
+ ->with('')
+ ->will($this->returnValue(true));
+
+ $info = new \OC\Files\FileInfo('/foo.txt', null, null, array(
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
+ ), null);
+
+ $file = new OC_Connector_Sabre_File($view, $info);
+
+ $this->assertNotEmpty($file->put('test data'));
+ }
+
/**
* @expectedException \Sabre\DAV\Exception
*/
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 158c964fd0d..5e42e5ffd0f 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -729,6 +729,22 @@ class View extends \Test\TestCase {
);
}
+ public function testFileView() {
+ $storage = new Temporary(array());
+ $scanner = $storage->getScanner();
+ $storage->file_put_contents('foo.txt', 'bar');
+ \OC\Files\Filesystem::mount($storage, array(), '/test/');
+ $scanner->scan('');
+ $view = new \OC\Files\View('/test/foo.txt');
+
+ $this->assertEquals('bar', $view->file_get_contents(''));
+ $fh = tmpfile();
+ fwrite($fh, 'foo');
+ rewind($fh);
+ $view->file_put_contents('', $fh);
+ $this->assertEquals('foo', $view->file_get_contents(''));
+ }
+
/**
* @dataProvider tooLongPathDataProvider
* @expectedException \OCP\Files\InvalidPathException