@@ -329,7 +329,7 @@ public function importFiles(
329329 $ fileName = $ this ->getFileName ($ fileItem , $ userId , in_array ($ fileItem ['id ' ], $ conflictingIds ));
330330
331331 // If file already exists in folder, don't download unless timestamp is different
332- if ($ saveFolder ->nodeExists ($ fileName )) {
332+ if ($ saveFolder ->nodeExists ($ fileName ) === true ) {
333333 $ savedFile = $ saveFolder ->get ($ fileName );
334334 $ timestampOnFile = $ savedFile ->getMtime ();
335335 $ d = new DateTime ($ fileItem ['modifiedTime ' ]);
@@ -349,7 +349,7 @@ public function importFiles(
349349 $ this ->config ->setUserValue ($ userId , Application::APP_ID , 'nb_imported_files ' , $ alreadyImported + $ nbDownloaded );
350350 $ downloadedSize += $ size ;
351351 $ this ->config ->setUserValue ($ userId , Application::APP_ID , 'drive_imported_size ' , $ alreadyImportedSize + $ downloadedSize );
352- if ($ maxDownloadSize && $ downloadedSize > $ maxDownloadSize ) {
352+ if ($ maxDownloadSize !== null && $ downloadedSize > $ maxDownloadSize ) {
353353 return [
354354 'nbDownloaded ' => $ nbDownloaded ,
355355 'targetPath ' => $ targetPath ,
@@ -362,7 +362,7 @@ public function importFiles(
362362 }
363363 } catch (\Throwable $ e ) {
364364 $ this ->logger ->warning ('Error while importing file ' , ['exception ' => $ e ]);
365- $ this ->logger ->debug ('Skipping file ' . $ fileItem ['id ' ]);
365+ $ this ->logger ->debug ('Skipping file ' . strval ( $ fileItem ['id ' ]) );
366366 continue ;
367367 }
368368 }
@@ -692,11 +692,11 @@ private function getFile(string $userId, array $fileItem, Folder $saveFolder, st
692692 $ documentFormat = $ this ->getUserDocumentFormat ($ userId );
693693 // potentially a doc
694694 $ params = $ this ->getDocumentRequestParams ($ fileItem ['mimeType ' ], $ documentFormat );
695- $ fileUrl = 'https://www.googleapis.com/drive/v3/files/ ' . urlencode ($ fileItem ['id ' ]) . '/export ' ;
695+ $ fileUrl = 'https://www.googleapis.com/drive/v3/files/ ' . urlencode (( string ) $ fileItem ['id ' ]) . '/export ' ;
696696 return $ this ->downloadAndSaveFile ($ saveFolder , $ fileName , $ userId , $ fileUrl , $ fileItem , $ params );
697697 } elseif (isset ($ fileItem ['webContentLink ' ])) {
698698 // classic file
699- $ fileUrl = 'https://www.googleapis.com/drive/v3/files/ ' . urlencode ($ fileItem ['id ' ]) . '?alt=media ' ;
699+ $ fileUrl = 'https://www.googleapis.com/drive/v3/files/ ' . urlencode (( string ) $ fileItem ['id ' ]) . '?alt=media ' ;
700700 return $ this ->downloadAndSaveFile ($ saveFolder , $ fileName , $ userId , $ fileUrl , $ fileItem );
701701 }
702702 return null ;
0 commit comments