Skip to content

Commit

Permalink
fix: double prefix in laravel version > 9.33.0
Browse files Browse the repository at this point in the history
  • Loading branch information
krissss committed Mar 1, 2024
1 parent b28490f commit 7193386
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ class UserAvatarController

排名不分先后,不做具体推荐

| 厂商 | 扩展包 | 支持 Laravel9 | 安装使用 |
|-------------|----------------------------------------------------------------------------------|-------------|----------------------------------------|
| Aliyun OSS | [iidestiny/flysystem-oss](https://github.com/iiDestiny/laravel-filesystem-oss) || [文档](./docs/extends/oss-iidestiny.md) |
| QiNiu | [overtrue/flysystem-qiniu](https://github.com/overtrue/laravel-filesystem-qiniu) || [文档](./docs/extends/qiniu-overtrue.md) |
| Tencent COS | [overtrue/flysystem-cos](https://github.com/overtrue/laravel-filesystem-cos) || [文档](./docs/extends/cos-overtrue.md) |
| Aliyun OSS | [alphasnow/aliyun-oss-laravel](https://github.com/alphasnow/aliyun-oss-laravel) || [文档](./docs/extends/oss-alphasnow.md) |
| 厂商 | 扩展包 | 支持 Laravel>=9 | 安装使用 |
|-------------|----------------------------------------------------------------------------------|---------------|----------------------------------------|
| Aliyun OSS | [iidestiny/flysystem-oss](https://github.com/iiDestiny/laravel-filesystem-oss) | | [文档](./docs/extends/oss-iidestiny.md) |
| QiNiu | [overtrue/flysystem-qiniu](https://github.com/overtrue/laravel-filesystem-qiniu) | | [文档](./docs/extends/qiniu-overtrue.md) |
| Tencent COS | [overtrue/flysystem-cos](https://github.com/overtrue/laravel-filesystem-cos) | | [文档](./docs/extends/cos-overtrue.md) |
| Aliyun OSS | [alphasnow/aliyun-oss-laravel](https://github.com/alphasnow/aliyun-oss-laravel) | | [文档](./docs/extends/oss-alphasnow.md) |
5 changes: 5 additions & 0 deletions src/Extend/FlysystemV3/OssAlphaSnowExtend.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ class OssAlphaSnowExtend implements ExtendInterface
*/
public static function createFilesystemAdapter($config): FilesystemAdapter
{
// 由于无法直接获取到 laravel 的版本,因此不能用版本比较的方式,此处改为默认为 true
// 如果真的使用的 laravel 的版本小于 9.33.0,
// 可以手动在 filesystems.php 中添加一个 'url_prefixed' => false 的配置
//$config['url_prefixed'] = version_compare($app->version(), '9.33.0', '>=');
$config['url_prefixed'] = $config['url_prefixed'] ?? true;

$client = Container::get(AliyunFactory::class)->createClient($config);
$adapter = new AliyunAdapter($client, $config['bucket'], $config['prefix'] ?? '', $config);
$driver = new Filesystem($adapter);
Expand Down

0 comments on commit 7193386

Please sign in to comment.