Showing
1 changed file
with
7 additions
and
1 deletions
| ... | @@ -259,9 +259,15 @@ class ImageService | ... | @@ -259,9 +259,15 @@ class ImageService |
| 259 | $storageUrl = config('filesystems.url'); | 259 | $storageUrl = config('filesystems.url'); |
| 260 | 260 | ||
| 261 | // Get the standard public s3 url if s3 is set as storage type | 261 | // Get the standard public s3 url if s3 is set as storage type |
| 262 | + // Uses the nice, short URL if bucket name has no periods in otherwise the longer | ||
| 263 | + // region-based url will be used to prevent http issues. | ||
| 262 | if ($storageUrl == false && config('filesystems.default') === 's3') { | 264 | if ($storageUrl == false && config('filesystems.default') === 's3') { |
| 263 | $storageDetails = config('filesystems.disks.s3'); | 265 | $storageDetails = config('filesystems.disks.s3'); |
| 264 | - $storageUrl = 'https://' . $storageDetails['bucket'] . '.s3.amazonaws.com'; | 266 | + if (strpos($storageDetails['bucket'], '.') === false) { |
| 267 | + $storageUrl = 'https://' . $storageDetails['bucket'] . '.s3.amazonaws.com'; | ||
| 268 | + } else { | ||
| 269 | + $storageUrl = 'https://s3-' . $storageDetails['region'] . '.amazonaws.com/' . $storageDetails['bucket']; | ||
| 270 | + } | ||
| 265 | } | 271 | } |
| 266 | 272 | ||
| 267 | $this->storageUrl = $storageUrl; | 273 | $this->storageUrl = $storageUrl; | ... | ... |
-
Please register or sign in to post a comment