Skip to content
Merged
Changes from all commits
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
22 changes: 21 additions & 1 deletion lib/private/Files/Storage/Wrapper/Checksum.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,22 @@ private static function getChecksumsInDbFormat($path) {
return rtrim($checksumString);
}

/**
* check if the file metadata should not be fetched
* NOTE: files with a '.part' extension are ignored as well!
* prevents unfinished put requests to fetch metadata which does not exists
*
* @param string $file
* @return boolean
*/
public static function isPartialFile($file) {
if (pathinfo($file, PATHINFO_EXTENSION) === 'part') {
return true;
}

return false;
}

/**
* @param string $path
* @param string $data
Expand All @@ -168,7 +184,11 @@ public function file_put_contents($path, $data) {
* @return array
*/
public function getMetaData($path) {
$parentMetaData = $this->getWrapperStorage()->getMetaData($path);
// Check if it is partial file. Partial file metadata are only checksums
$parentMetaData = [];
if(!self::isPartialFile($path)) {
$parentMetaData = $this->getWrapperStorage()->getMetaData($path);
}
$parentMetaData['checksum'] = self::getChecksumsInDbFormat($path);

if (!isset($parentMetaData['mimetype'])) {
Expand Down