Commit f76419d1 authored by Adam Williamson's avatar Adam Williamson
Browse files

fix touch() when $mtime is set (Google wants RFC3339) #11267

ownCloud passes us a Unix time integer, but the GDrive API wants
an RFC3339-formatted date. Actually it wants a single particular
RFC3339 format, not just anything that complies will do - it
requires the fractions to be specified, though RFC3339 doesn't.

This resolves issue #11267 (and was also noted by PVince81 in
reviewing PR #6989).
parent 2023878d
......@@ -496,7 +496,10 @@ class Google extends \OC\Files\Storage\Common {
$result = false;
if ($file) {
if (isset($mtime)) {
$file->setModifiedDate($mtime);
// This is just RFC3339, but frustratingly, GDrive's API *requires*
// the fractions portion be present, while no handy PHP constant
// for RFC3339 or ISO8601 includes it. So we do it ourselves.
$file->setModifiedDate(date('Y-m-d\TH:i:s.uP', $mtime));
$result = $this->service->files->patch($file->getId(), $file, array(
'setModifiedDate' => true,
));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment