masbug / flysystem-google-drive-ext

Flysystem adapter for Google Drive with seamless virtual<=>display path translation
Other
214 stars 60 forks source link

useDisplayPaths is false, but return original filename #128

Open deesouza-ps opened 1 month ago

deesouza-ps commented 1 month ago

I have this code below. Same the property useDisplayPaths with false, on upload return the original filename.

Storage::extend('google', function ($app, $config) {
    $client = new GoogleClient();
    $client->setClientId($config['clientId']);
    $client->setClientSecret($config['clientSecret']);
    $client->refreshToken($config['refreshToken']);

    $service = new GoogleServiceDrive($client);
    $adapter = new GoogleDriveAdapter($service, $config['folderId'], [
        'useDisplayPaths' => false,
    ]);
    $driver = new Filesystem($adapter);

    return new FilesystemAdapter($driver, $adapter);
});

Upload

$fileNameUpload = $fileUpload->storeAs('ID_PATH_GOOGLE_DRIVE', $fileName, 'google');
erikn69 commented 1 month ago

the main functionality is useDisplayPaths => true, but: erikn69/laravel-google-drive-ext-demo/routes/web.php#L44-L48 ivanvermeyen/laravel-google-drive-demo/routes/web.php#L74-L84

Also feel free to open a PR

angeljqv commented 4 weeks ago

That is the laravel expected behaivor, this package works independently of Laravel

deesouza-ps commented 3 weeks ago

When useDisplayPaths is true should return filename original. But, when useDisplayPaths is false should return filename with the name that the Google give.

Sorry, but am'I wrong?

angeljqv commented 3 weeks ago

Sorry, but am'I wrong?

Big yes, laravel handles only display paths, that means it return original filename, check laravel sources

this package works independently of Laravel

and useDisplayPaths = false is only for emulate old https://github.com/nao-pon/flysystem-google-drive package

If you feel it should work the way you want feel free to open a PR with your changes.