Skip to content

Commit

Permalink
Use non empty files for object store touch
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Nov 15, 2017
1 parent a21f2c2 commit e041c7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Expand Up @@ -364,7 +364,7 @@ public function touch($path, $mtime = null) {
$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, [
Expand Down Expand Up @@ -392,7 +392,7 @@ public function writeBack($tmpFile, $path) {
$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);
Expand Down

0 comments on commit e041c7a

Please sign in to comment.