Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue generating URL when specifying a 'root' filesystem path #41964

Closed
bennettblack opened this issue Apr 13, 2022 · 1 comment
Closed

Issue generating URL when specifying a 'root' filesystem path #41964

bennettblack opened this issue Apr 13, 2022 · 1 comment

Comments

@bennettblack
Copy link

  • Laravel Version: 9.8
  • PHP Version: 8.1.3
  • Database Driver & Version: DB2 for IBM iSeries (third party driver)

Description:

I'm using Digital Ocean Spaces to host website assets. If I specify a 'root' path in filesystems.php for any DO disk, I run into issues retrieving the files. If I remove the 'root' key and write the folder path manually, I don't have any issues. Specifically, it looks like the end path character "/" is being converted to "%5C". Note, I only encountered this issue after upgrading from L8 to L9.

Here's how I'm generating the URL in my Blade:

<img src="{{ Storage::disk('vendor-logos')->url($vendor->image) }}" alt="{{ $vendor->name }}">

Here's the HTML that produces:
<img src="https://bwi.nyc3.digitaloceanspaces.com/vendor-logos%5Cb574d580c91d97b6b12155708ecc61a3c0779750" alt="BASF">

Note how the src path above is missing a / , right after the root location 'vendor-logos'. Any file I display like this gets prepended with a %5C. I could be going in the wrong direction, but a quick Google search shows that 5c is the hex ASCII representation of "backslash".

Disk:

'vendor-logos' => [
    'driver'        => 's3',
    'key'           => env('DIGITALOCEAN_SPACES_KEY'),
    'secret'        => env('DIGITALOCEAN_SPACES_SECRET'),
    'endpoint'      => 'https://nyc3.digitaloceanspaces.com',
    'region'        => 'nyc',
    'bucket'        => 'bwi',
    'root'          => 'vendor-logos',
    'visibility'    => 'public',
],

Here's a snippet of my vendor model's underlying table. The highlighted record is the one used in my example above.
image

Steps To Reproduce:

  1. Setup a disk in L9 that uses digital ocean spaces.
  2. Define a 'root' key in the filesystem config for that disk
  3. Make sure the asset in your digital ocean space is in the folder that corresponds to the 'root' path you specified in filesystems.php
  4. Try to display the asset in a blade.
@driesvints
Copy link
Member

Since Laravel v9 switched to Flysystem v3, I suspect this is either a configuration issue or a Flyststem issue.

Can you first please try the Flysystem issue tracker or one of the support channels below? If you can actually identify this as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants