laravel-google-cloud-storage icon indicating copy to clipboard operation
laravel-google-cloud-storage copied to clipboard

URL Generation Bug on Windows Systems with Prefixes

Open seerazz opened this issue 4 months ago • 0 comments

We encountered an issue with URL generation on Windows systems. When we specify a prefix (e.g., local/files) in the storage configuration, the generated URLs contain an incorrect path separator (\ instead of /), leading to broken URLs.

examples:

Generated URL:

$disk->url('921/assets.zip')

produce: https://my-domain.com/local/files\921/assets.zip

Temporary Signed URL:

 $signedUrl = $disk->temporaryUrl('921/assets.zip', now()->addMinutes(10));

produce: https://my-domain.com/local/files%5C921/assets.zip?GoogleAccessId=xxx

The expected behavior is that the URL should use forward slashes (/) for both the generated and signed URLs, regardless of the system platform.

Environment: Windows system

This issue only occurs on Windows and seems to be related to how path separators are handled with the prefix option.

Would it be possible to ensure cross-platform compatibility for URL generation?

seerazz avatar Oct 04 '24 03:10 seerazz