Skip to content

Storage Decorator can cause wrong logic to be performed due to overriding the "driver" #775

@grEvenX

Description

@grEvenX

How do you use Sentry?

Self-hosted / on-premises

SDK version

3.8.0

Steps to reproduce

We're currently using the spatie/laravel-medialibrary package together with sentry-laravel.
After deploying the latest changes with the new approach to wrapping the disk configuration (introduced in #750) we experienced a problem uploading files to S3.

The changes in the given PR overrides the config("filesystems.disks.{$this->disk}.driver") for any given disk to become sentry. Any code that relies on checking which driver is being used in this way (through config) now fails to apply it's logic correctly.

Example logic in the Spatie media library where $diskDriverName is fetched from the config function above:

if (! in_array($diskDriverName, ['s3', 'gcs'], true)) {
  $this->filesystem->disk($diskName)->makeDirectory($directory);
}

PS: It still works in this case, the reason we caught this problem was that we hadn't enabled permission to create directories in S3, so it worked fine when not trying to create a directory but upload the fille "put()" directly.

Expected result

Enabling tracing on the Storage in a Laravel application should not affect logic

Actual result

Enabling tracing on the Storage in a Laravel application can potentially affect logic

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions