diff options
author | Adam Williamson <awilliam@redhat.com> | 2014-11-08 00:38:00 -0800 |
---|---|---|
committer | Adam Williamson <awilliam@redhat.com> | 2014-11-10 11:56:01 -0800 |
commit | f76419d190ab1557dcd333ebe7a9519340a2b0a7 (patch) | |
tree | a38056ae0a2fc657589aa662bebc6a9258ec6eb4 /apps | |
parent | 2023878d537374b47494eb8ce44d3757b3692626 (diff) | |
download | nextcloud-server-f76419d190ab1557dcd333ebe7a9519340a2b0a7.tar.gz nextcloud-server-f76419d190ab1557dcd333ebe7a9519340a2b0a7.zip |
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).
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/lib/google.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php index 62b0f182e98..a4337bc937b 100644 --- a/apps/files_external/lib/google.php +++ b/apps/files_external/lib/google.php @@ -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, )); |