laravel-azure-storage icon indicating copy to clipboard operation
laravel-azure-storage copied to clipboard

Invalid URL generation when using the `prefix` config

Open alkin opened this issue 2 years ago • 1 comments

Checklist

This package is just a wrapper for Flysystem's Azure storage backend to integrate it with Laravel's storage API. As such, many problems users may experience with it may actually be issues with Flysystem, the Azure driver for Flysystem, or Microsoft's PHP SDK. To help eliminate these issues, please confirm the following:

  • [x] I'm able to instantiate a Flysystem instance using the same credentials as passed to this package.
  • [x] The Flysystem instance works as expected, and the bug I am reporting is not reproducible when interacting directly with Flysystem
  • [x] I can instantiate the Microsoft Azure PHP SDK successfully and can interact with my file successfully using that

Describe the bug When using a configured prefix, the URL returned by the url method ignores the prefix and is invalid.

To Reproduce

  1. Config a disk with a prefix: my_prefix.
  2. Using the package, create a simple file test.txt with any content.
  3. Generate the URL for the file using the url() method.
  4. Notice that the URL does not contain the prefix.
  5. Open the URL in the browser and confirm that the file is not accessible on the informed URL.
  6. Manually add the prefix in the URL and open in the browser.
  7. Confirm that the file was created with the correct prefix.

Expected behavior The URL returned form the url() method should be correct and contain the prefix configured.

Packages and PHP version Any

Screenshots image image image image

Desktop (please complete the following information): Any

Smartphone (please complete the following information): Any

alkin avatar Sep 17 '22 04:09 alkin

I've put together a test case for this (and finally got around to migrating the package from PHPUnit to Pest), and have implemented a fix which resolves the broken test case, and have published it as 2.0.5. However, I don't currently have access to an Azure blob storage account so can't verify it works myself.

Can you confirm this has resolved the issue for you?

matthewbdaly avatar Sep 18 '22 15:09 matthewbdaly

Closed due to not hearing back

matthewbdaly avatar Apr 12 '23 11:04 matthewbdaly