Skip to content
Draft
Show file tree
Hide file tree
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
29 changes: 19 additions & 10 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,17 @@ public function put($data) {
}
}

// since we skipped the view we need to scan and emit the hooks ourselves
// allow sync clients to send the mtime along in a header
$mtimeHeader = $this->request->getHeader('x-oc-mtime');
$mtime = ($mtimeHeader !== '') ? $this->sanitizeMtime($mtimeHeader) : null;

// Apply mtime to storage before the scanner picks it up
$nativeTouchSucceeded = false;
if ($mtime !== null) {
$nativeTouchSucceeded = $storage->touch($internalPath, $mtime);
}

// Since we skipped the view we need to scan and emit the hooks ourselves
$storage->getUpdater()->update($internalPath);

try {
Expand All @@ -342,19 +352,18 @@ public function put($data) {
throw new FileLocked($e->getMessage(), $e->getCode(), $e);
}

// allow sync clients to send the mtime along in a header
$mtimeHeader = $this->request->getHeader('x-oc-mtime');
if ($mtimeHeader !== '') {
$mtime = $this->sanitizeMtime($mtimeHeader);
if ($this->fileView->touch($this->path, $mtime)) {
$fileInfoUpdate = [
'upload_time' => time(),
];

if ($mtime !== null) {
if (!$nativeTouchSucceeded) {
// Native touch unsupported — write mtime directly to cache
$fileInfoUpdate['mtime'] = $mtime;
$this->header('X-OC-MTime: accepted');
}
}

$fileInfoUpdate = [
'upload_time' => time()
];

// allow sync clients to send the creation time along in a header
$ctimeHeader = $this->request->getHeader('x-oc-ctime');
if ($ctimeHeader) {
Expand Down
1 change: 0 additions & 1 deletion build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@
<code><![CDATA[resolvePath]]></code>
<code><![CDATA[resolvePath]]></code>
<code><![CDATA[resolvePath]]></code>
<code><![CDATA[touch]]></code>
<code><![CDATA[unlink]]></code>
</InternalMethod>
<LessSpecificReturnStatement>
Expand Down
Loading