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

阿里云OSS返回的直链URL转义问题 #1705

Closed
actionee opened this issue Apr 19, 2023 · 1 comment
Closed

阿里云OSS返回的直链URL转义问题 #1705

actionee opened this issue Apr 19, 2023 · 1 comment

Comments

@actionee
Copy link

使用情景如下:
为OSS存储策略配置存储路径为 {uid}/{path}
然后在根目录OSS中上传photo.jpg图片,选择获取外链,得到:
https://www.example.com/1%2FOSS%2Fphoto.jpg...

本应该是
https://www.example.com/1/OSS/photo.jpg...

如果只是图片还好,但我要直链的原因是在oss托管了静态的html文件,如果url中的 / 被转义,就会导致相对路径识别出错,直接到顶层路径了。

例如, https://www.example.com/1/OSS/vuepress/index.html 中的 svgjs 都在 二级 目录下,

...
<link rel="icon" type="image/svg+xml" href="/image/vite.svg" />
<script type="module" src="/src/main.js"></script>
...

URL中的 / 被转义为 %2F 后,
https://www.example.com/1%2FOSS%2Fvuepress%2Findex.html 虽然也可以直接访问 index.html ,但会导致 index.html 里的 svgjs 文件请求路径变成一级目录路径。

/main.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
/vite.svg:1
Failed to load resource: the server responded with a status of 403 (Forbidden)

请问该如何调整该规则以不要转义 /%2F 呢?

  • Version [3.7.1 pro]
@HFO4
Copy link
Member

HFO4 commented Apr 19, 2023

底层SDK的行为,参考 aliyun/aliyun-oss-go-sdk#82

@HFO4 HFO4 closed this as completed Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants