From a21f2c2813ae15d1811eb357fbb9a2c3b5769142 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 8 Nov 2017 17:50:46 +0100 Subject: [PATCH 1/2] Fix contructing headers for s3 download Signed-off-by: Robin Appelman --- lib/private/Files/ObjectStore/S3ObjectTrait.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 4bfa08a3e5..63eb562fb1 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -50,9 +50,15 @@ trait S3ObjectTrait { 'Key' => $urn ]); $request = \Aws\serialize($command); + $headers = []; + foreach ($request->getHeaders() as $key => $values) { + foreach ($values as $value) { + $headers[] = "$key: $value"; + } + } $opts = [ 'http' => [ - 'header' => $request->getHeaders() + 'header' => $headers ] ]; From e041c7a92f78b0dc2ca0ff820353e154dd67d76b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 8 Nov 2017 17:51:02 +0100 Subject: [PATCH 2/2] Use non empty files for object store touch Signed-off-by: Robin Appelman --- lib/private/Files/ObjectStore/ObjectStoreStorage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 15df808684..79ce7ee324 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -364,7 +364,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { $fileId = $this->getCache()->put($path, $stat); try { //read an empty file from memory - $this->objectStore->writeObject($this->getURN($fileId), fopen('php://memory', 'r')); + $this->file_put_contents($path, ' '); } catch (\Exception $ex) { $this->getCache()->remove($path); $this->logger->logException($ex, [ @@ -392,7 +392,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { $stat['storage_mtime'] = $mTime; // run path based detection first, to use file extension because $tmpFile is only a random string - $mimetypeDetector = \OC::$server->getMimeTypeDetector(); + $mimetypeDetector = \OC::$server->getMimeTypeDetector(); $mimetype = $mimetypeDetector->detectPath($path); if ($mimetype === 'application/octet-stream') { $mimetype = $mimetypeDetector->detect($tmpFile);