summaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2017-11-14 20:38:50 +0100
committerGitHub <noreply@github.com>2017-11-14 20:38:50 +0100
commitc225bbd0216ff4a2acc615fac3ca0cf6a84e1ef4 (patch)
treed503d98f3f2929b688aacd61a90659c0c00abb69 /lib/private/Files
parenta3f86b99e95ca71799df5f08b18ceb7e77f82b66 (diff)
parentc566b2854badc6e4c99c308ac6f5a9f49eb87e3a (diff)
downloadnextcloud-server-c225bbd0216ff4a2acc615fac3ca0cf6a84e1ef4.tar.gz
nextcloud-server-c225bbd0216ff4a2acc615fac3ca0cf6a84e1ef4.zip
Merge pull request #7113 from nextcloud/s3-download-stream-fix
Fix s3 download and touch
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php4
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php8
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 15df808684b..79ce7ee3247 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);
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index b418219c29b..9c5cf9ccc6c 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -52,9 +52,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
]
];