|
|
@@ -210,11 +210,7 @@ class File extends Node implements IFile { |
|
|
|
// allow sync clients to send the mtime along in a header |
|
|
|
$request = \OC::$server->getRequest(); |
|
|
|
if (isset($request->server['HTTP_X_OC_MTIME'])) { |
|
|
|
$mtimeStr = $request->server['HTTP_X_OC_MTIME']; |
|
|
|
if (!is_numeric($mtimeStr)) { |
|
|
|
throw new \InvalidArgumentException('X-OC-Mtime header must be an integer (unix timestamp).'); |
|
|
|
} |
|
|
|
$mtime = intval($mtimeStr); |
|
|
|
$mtime = $this->sanitizeMtime($request->server['HTTP_X_OC_MTIME']); |
|
|
|
if ($this->fileView->touch($this->path, $mtime)) { |
|
|
|
header('X-OC-MTime: accepted'); |
|
|
|
} |
|
|
@@ -472,7 +468,8 @@ class File extends Node implements IFile { |
|
|
|
// allow sync clients to send the mtime along in a header |
|
|
|
$request = \OC::$server->getRequest(); |
|
|
|
if (isset($request->server['HTTP_X_OC_MTIME'])) { |
|
|
|
if ($targetStorage->touch($targetInternalPath, $request->server['HTTP_X_OC_MTIME'])) { |
|
|
|
$mtime = $this->sanitizeMtime($request->server['HTTP_X_OC_MTIME']); |
|
|
|
if ($targetStorage->touch($targetInternalPath, $mtime)) { |
|
|
|
header('X-OC-MTime: accepted'); |
|
|
|
} |
|
|
|
} |
|
|
@@ -570,6 +567,14 @@ class File extends Node implements IFile { |
|
|
|
throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |
|
|
|
} |
|
|
|
|
|
|
|
private function sanitizeMtime($mtimeFromRequest) { |
|
|
|
if (!is_numeric($mtimeFromRequest)) { |
|
|
|
throw new \InvalidArgumentException('X-OC-MTime header must be an integer (unix timestamp).'); |
|
|
|
} |
|
|
|
|
|
|
|
return intval($mtimeFromRequest); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Get the checksum for this file |
|
|
|
* |