spatie / flysystem-dropbox

A flysystem driver for Dropbox that uses the v2 API
https://freek.dev/734-dropbox-will-turn-off-v1-of-their-api-soon-its-time-to-update-your-php-application
MIT License
342 stars 50 forks source link

File download with Dropbox ID #80

Closed thomascombe closed 2 years ago

thomascombe commented 2 years ago

Hi, Thank' for this package!

I found a mistake:

Action:

I try to download file using his Dropbox ID (id:xxx)

Error:

File not found at path: id:xxx

Investigation:

After investigation I think the mistake is on applyPathPrefix method.

After prefix apply, API call param is /id:

Solution:

Quick dirty fix for me:

    /**
     * {@inheritdoc}
     */
    public function applyPathPrefix($path): string
    {
        if (Str::startsWith($path, 'id:')) {
            return Str::replaceFirst('/id:', 'id:', parent::applyPathPrefix($path));
        }
        return parent::applyPathPrefix($path);
    }
spatie-bot commented 2 years ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.