Skip to content

Commit 7193386

Browse files
committed
fix: double prefix in laravel version > 9.33.0
1 parent b28490f commit 7193386

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ class UserAvatarController
9898

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

101-
| 厂商 | 扩展包 | 支持 Laravel9 | 安装使用 |
102-
|-------------|----------------------------------------------------------------------------------|-------------|----------------------------------------|
103-
| Aliyun OSS | [iidestiny/flysystem-oss](https://github.com/iiDestiny/laravel-filesystem-oss) || [文档](./docs/extends/oss-iidestiny.md) |
104-
| QiNiu | [overtrue/flysystem-qiniu](https://github.com/overtrue/laravel-filesystem-qiniu) || [文档](./docs/extends/qiniu-overtrue.md) |
105-
| Tencent COS | [overtrue/flysystem-cos](https://github.com/overtrue/laravel-filesystem-cos) || [文档](./docs/extends/cos-overtrue.md) |
106-
| Aliyun OSS | [alphasnow/aliyun-oss-laravel](https://github.com/alphasnow/aliyun-oss-laravel) || [文档](./docs/extends/oss-alphasnow.md) |
101+
| 厂商 | 扩展包 | 支持 Laravel>=9 | 安装使用 |
102+
|-------------|----------------------------------------------------------------------------------|---------------|----------------------------------------|
103+
| Aliyun OSS | [iidestiny/flysystem-oss](https://github.com/iiDestiny/laravel-filesystem-oss) | | [文档](./docs/extends/oss-iidestiny.md) |
104+
| QiNiu | [overtrue/flysystem-qiniu](https://github.com/overtrue/laravel-filesystem-qiniu) | | [文档](./docs/extends/qiniu-overtrue.md) |
105+
| Tencent COS | [overtrue/flysystem-cos](https://github.com/overtrue/laravel-filesystem-cos) | | [文档](./docs/extends/cos-overtrue.md) |
106+
| Aliyun OSS | [alphasnow/aliyun-oss-laravel](https://github.com/alphasnow/aliyun-oss-laravel) | | [文档](./docs/extends/oss-alphasnow.md) |

src/Extend/FlysystemV3/OssAlphaSnowExtend.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ class OssAlphaSnowExtend implements ExtendInterface
1919
*/
2020
public static function createFilesystemAdapter($config): FilesystemAdapter
2121
{
22+
// 由于无法直接获取到 laravel 的版本,因此不能用版本比较的方式,此处改为默认为 true
23+
// 如果真的使用的 laravel 的版本小于 9.33.0,
24+
// 可以手动在 filesystems.php 中添加一个 'url_prefixed' => false 的配置
2225
//$config['url_prefixed'] = version_compare($app->version(), '9.33.0', '>=');
26+
$config['url_prefixed'] = $config['url_prefixed'] ?? true;
27+
2328
$client = Container::get(AliyunFactory::class)->createClient($config);
2429
$adapter = new AliyunAdapter($client, $config['bucket'], $config['prefix'] ?? '', $config);
2530
$driver = new Filesystem($adapter);

0 commit comments

Comments
 (0)