Use non empty files for object store touch

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-11-08 17:51:02 +01:00
parent a21f2c2813
commit e041c7a92f
No known key found for this signature in database
GPG Key ID: CBCA68FBAEBF98C9
1 changed files with 2 additions and 2 deletions

View File

@ -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);