mirror of
https://github.com/nextcloud/server.git
synced 2026-03-05 06:50:55 -05:00
Merge pull request #3793 from stefan-squareweave/master
Correct incorrectly typed X-OC-Mtime header
This commit is contained in:
commit
1045bf4a2b
2 changed files with 7 additions and 2 deletions
|
|
@ -206,7 +206,12 @@ 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 ($this->fileView->touch($this->path, $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);
|
||||
if ($this->fileView->touch($this->path, $mtime)) {
|
||||
header('X-OC-MTime: accepted');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ OC.FileUpload.prototype = {
|
|||
|
||||
if (file.lastModified) {
|
||||
// preserve timestamp
|
||||
this.data.headers['X-OC-Mtime'] = file.lastModified / 1000;
|
||||
this.data.headers['X-OC-Mtime'] = (file.lastModified / 1000).toFixed(0);
|
||||
}
|
||||
|
||||
var userName = this.uploader.filesClient.getUserName();
|
||||
|
|
|
|||
Loading…
Reference in a new issue