ivanvermeyen / laravel-google-drive-demo

Laravel & Google Drive Storage - Demo project with Laravel 5.4
405 stars 155 forks source link

Getting folder references return null even when file exists sometimes. #45

Open narcisonunez opened 6 years ago

narcisonunez commented 6 years ago

Hello,

I'm facing an issue that I can't test easily.

I have this folder structure (if not exists I need to created)

clientFolder > year > month > projectId - ProjectName > clientAssets|workingAssets

I have helpers to get each folder references and it works most of the times but there is sometimes where getting the references of a folder/file give me null when I now their exists.

this is an example of the folder references helper. I can say it works like 95% but sometimes return null event when the folder exists.


     * Get the client folder reference in google drive.
     *
     * @param Project $project
     * @param $contents
     * @return mixed
     */
    public function getClientDir($project, $contents)
    {
        return $contents->where('type', '=', 'dir')
            ->where('filename', '=', $project->order->client->name)
            ->first();
    }```

Also, this only happens using GOOGLE_DRIVE_FOLDER_ID, I have been testing without it and never fails, but as I said is random.
narcisonunez commented 6 years ago

UPDATE: Now is happening that when I try to create multiple folders when a project belongs to the new month (Client > Year > Month > ... ) the makeDirectory method is creating all the folders in the root directory.

Note: Only sometimes this is happening.