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

参数转义问题 #13

Closed
elonzh opened this issue Jul 2, 2020 · 1 comment
Closed

参数转义问题 #13

elonzh opened this issue Jul 2, 2020 · 1 comment

Comments

@elonzh
Copy link

elonzh commented Jul 2, 2020

使用参数传递 github 下载地址会有转义问题,这个对写脚本会造成一些困扰

...
ENV CATTLE_K3S_VERSION v1.17.2+k3s1

ENV K3S_URL_amd64="https://gh.api.99988866.xyz/?q=https://github.com/rancher/k3s/releases/download/${CATTLE_K3S_VERSION}/k3s" \
    K3S_URL_arm64="https://gh.api.99988866.xyz/?q=https://github.com/rancher/k3s/releases/download/${CATTLE_K3S_VERSION}/k3s-arm64" \
    K3S_URL=K3S_URL_${ARCH} \

由于版本号中有个 +,直接把原地址加个前缀会导致解析出现问题:

地址

https://gh.api.99988866.xyz/?q=https://github.com/rancher/k3s/releases/download/v1.17.2+k3s1/k3s

会跳转至

https://gh.api.99988866.xyz/https:/github.com/rancher/k3s/releases/download/v1.17.2%20k3s1/k3s

然而这个地址是无效的。

当把 + 转义为 %2B 后请求正常:

https://gh.api.99988866.xyz/?q=https://github.com/rancher/k3s/releases/download/v1.17.2%2Bk3s1/k3s

建议能够提供类似 jsdelivr 的路径方式:

https://cdn.jsdelivr.net/gh/rancher/k3s@v1.17.2+k3s1/k3s

@hunshcn
Copy link
Owner

hunshcn commented Jul 2, 2020

改用js跳转,已解决
hunshcn/hunshcn.github.io@8946006

然后不建议在脚本里用?q=的形式,直接贴 https://gh.api.99988866.xyz/https:/github.com/xxxxxxxx 就行了

@hunshcn hunshcn closed this as completed Jul 4, 2020
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