Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 使用 S3插件上传到 Minio,不知道为啥,会自动在路径里面加多个 bucket 名称,传一次加一个 #36

Open
isFire opened this issue Sep 1, 2023 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@isFire
Copy link

isFire commented Sep 1, 2023

每上传一张图片,bucketName 就多一个,然后使用 picGo 和 picList 都会这样
image

@wayjam wayjam self-assigned this Sep 1, 2023
@wayjam wayjam added the bug Something isn't working label Sep 1, 2023
@wayjam
Copy link
Owner

wayjam commented Sep 2, 2023

插件只会根据参数的 endpointbucketName 拼接最终URL,理论上上述参数不变,不会每次都变化输出前缀

~/用最新版本验证结果 ❯❯❯ picgo upload xxx.jpeg
[PicGo INFO]: Before transform
[PicGo INFO]: Transforming... Current transformer is [path]
[PicGo INFO]: Before upload
[PicGo INFO]: Uploading... Current uploader is [aws-s3]
[PicGo SUCCESS]:
http://1.1.1.1:9090/test/2023/09/1991c1e07d83faac996335c3016ea91e.jpeg

@isFire
Copy link
Author

isFire commented Sep 4, 2023

只能我再研究下是不是我啥配置配的有问题了

@LeenHawk
Copy link

插件只会根据参数的 endpointbucketName 拼接最终URL,理论上上述参数不变,不会每次都变化输出前缀

~/用最新版本验证结果 ❯❯❯ picgo upload xxx.jpeg
[PicGo INFO]: Before transform
[PicGo INFO]: Transforming... Current transformer is [path]
[PicGo INFO]: Before upload
[PicGo INFO]: Uploading... Current uploader is [aws-s3]
[PicGo SUCCESS]:
http://1.1.1.1:9090/test/2023/09/1991c1e07d83faac996335c3016ea91e.jpeg

会的,配置不知道为啥一次多一个桶名

@isFire
Copy link
Author

isFire commented Sep 20, 2023

我想我可能找到问题在哪了,如果不设置PathStyle就没有这个问题,上面的 replace应该是将后边的 bucket 切掉是吧,但是没成功
image

@ExoticSkywing
Copy link

我也有这个问题,上传一次加一次

@zeahoo
Copy link

zeahoo commented Mar 15, 2024

相同的问题,我是使用s2的配置写的,也会自动加上bucket的路径

@Kuingsmile
Copy link
Contributor

Kuingsmile commented Apr 23, 2024

我想我可能找到问题在哪了,如果不设置PathStyle就没有这个问题,上面的 replace应该是将后边的 bucket 切掉是吧,但是没成功 image

问题不出在这里,replace这里只是将最后一个/切掉,问题是出在下一句添加bucket name后缀的代码上,这里是直接对userConfig变量的属性进行的操作,而对userConfig的操作,会直接修改对应PicGo实例的_config属性,由于桌面版上传时每次传递的是相同的一个PicGo实例,所以第二次上传获取到的新的userConfig变量的urlPrefix属性,就会延续上一次修改后的情况。

这也是为什么这个问题只在桌面版有,cli版本没有,因为cli版本每次上传都会新new一个PicGo实例出来,不会相互影响,而桌面版连续上传的时候传递的是同一个PicGo实例,上一次的修改会带入到下一次的上传。

修复方法示例如下,把urlPrefix先赋值给新变量,在修改和使用:

let urlPrefix = userConfig.urlPrefix
    if (urlPrefix) {
      urlPrefix = urlPrefix.replace(/\/?$/, "")
      if (userConfig.pathStyleAccess && !userConfig.disableBucketPrefixToURL) {
        urlPrefix += "/" + userConfig.bucketName
      }
    }

@Kuingsmile
Copy link
Contributor

@wayjam @isFire #40 已提交pr进行修复

@wayjam
Copy link
Owner

wayjam commented Apr 24, 2024

Released v1.3.6

@atusoft
Copy link

atusoft commented May 17, 2024

image
disableBucketPrefixToURL 在这个设置文件即使改成true, 在picgo界面里还是会被改成“false"字符串, 所以这段代码还是会有问题
if (userConfig.pathStyleAccess && !userConfig.disableBucketPrefixToURL) {

@Kuingsmile
Copy link
Contributor

disableBucketPrefixToURL在设置里用的是type input ,但这个变量是个布尔类型,应该用type confirm

@2591335205
Copy link

解决办法是在你的域名设置后面把你多出来的加上

@0ptimista
Copy link

Not only MinIO, but also adds a bucket suffix on Cloudflare R2 as well

Version 1.3.8

A workaround is add a bucket name on your customdomain. So that PicGo will spawn a correct URL for your image. But it leaves an adittion suffix on your storage provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants