File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -278,6 +278,12 @@ public function put($file, array $data) {
278278 * @throws \RuntimeException
279279 */
280280 public function insert ($ file , array $ data ) {
281+ // Some storage always return mtime at 0.
282+ // Use now as time if nothing else is provided
283+ if ($ data ["mtime " ] === 0 ) {
284+ $ data ["mtime " ] = time ();
285+ }
286+
281287 // normalize file
282288 $ file = $ this ->normalize ($ file );
283289
@@ -438,7 +444,8 @@ protected function normalizeData(array $data): array {
438444 $ extensionFields = ['metadata_etag ' , 'creation_time ' , 'upload_time ' ];
439445
440446 $ doNotCopyStorageMTime = false ;
441- if (array_key_exists ('mtime ' , $ data ) && $ data ['mtime ' ] === null ) {
447+ // some storage always have mtime null or zero, do use that
448+ if (array_key_exists ('mtime ' , $ data ) && ($ data ['mtime ' ] === null || $ data ['mtime ' ] === 0 )) {
442449 // this horrific magic tells it to not copy storage_mtime to mtime
443450 unset($ data ['mtime ' ]);
444451 $ doNotCopyStorageMTime = true ;
You can’t perform that action at this time.
0 commit comments