Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function put($data) {
$checksum = trim($this->request->server['HTTP_OC_CHECKSUM']);
$this->fileView->putFileInfo($this->path, ['checksum' => $checksum]);
$this->refreshInfo();
} else if ($this->getChecksum() !== null && $this->getChecksum() !== '') {
} else {
$this->fileView->putFileInfo($this->path, ['checksum' => '']);
$this->refreshInfo();
}
Expand Down Expand Up @@ -532,7 +532,7 @@ private function createFileChunked($data) {
if (isset($this->request->server['HTTP_OC_CHECKSUM'])) {
$checksum = trim($this->request->server['HTTP_OC_CHECKSUM']);
$this->fileView->putFileInfo($targetPath, ['checksum' => $checksum]);
} else if ($info->getChecksum() !== null && $info->getChecksum() !== '') {
} else {
$this->fileView->putFileInfo($this->path, ['checksum' => '']);
}

Expand Down
5 changes: 3 additions & 2 deletions lib/private/Files/Cache/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData =
/** @var CacheEntry $cacheData */
$cacheData = $this->cache->get($file);
}
if (empty($cacheData) || $cacheData['mtime'] != $data['mtime'] || $cacheData['checksum']==='') {
$data['checksum'] = md5_file($this->storage->getLocalFile($file));
}
if ($cacheData and $reuseExisting and isset($cacheData['fileid'])) {
// prevent empty etag
if (empty($cacheData['etag'])) {
Expand All @@ -216,8 +219,6 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData =
$fileId = -1;
}
if (!empty($newData)) {
// Reset the checksum if the data has changed
$newData['checksum'] = '';
$data['fileid'] = $this->addToCache($file, $newData, $fileId);
}
if (isset($cacheData['size'])) {
Expand Down
3 changes: 3 additions & 0 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,9 @@ public function putFileInfo($path, $data) {
*/
list($storage, $internalPath) = Filesystem::resolvePath($path);
if ($storage) {
if ($data['checksum'] == '') {
$data['checksum'] = md5_file($storage->getLocalFile($internalPath));
}
$cache = $storage->getCache($path);

if (!$cache->inCache($internalPath)) {
Expand Down