conwnet / github1s

One second to read GitHub code with VS Code.
https://github1s.com
MIT License
22.89k stars 871 forks source link

fix: char % in file path break blob api and bad sourcegraph lsif api parameters #440

Closed conwnet closed 2 years ago

conwnet commented 2 years ago

This PR resovles #439 mainly

Also I found I pass bad parameter to sourcegraph api, it will break lsif results. Also fix it here.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
github1s ✅ Ready (Inspect) Visit Preview Sep 2, 2022 at 11:24AM (UTC)
conwnet commented 2 years ago

The URL provided by @stevenlee7189 in #439 should be looks like below: https://github1s-git-encode-url-vscode-github1s.vercel.app/AspeedTech-BMC/openbmc/blob/aspeed-master/meta-aspeed-sdk/meta-ast2600-sdk/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04%25.bbappend

As @Siddhant-K-code said here, single % character should not be in a url path (because it is ambiguous). So we should encode it to %25 with encodeURI.

We can not visit url looks like https://github1s.com/%, server will throw a error, it seems the vercel's behavior.

Siddhant-K-code commented 2 years ago

We can not visit url looks like https://github1s.com/%, server will throw a error, it seems the vercel's behavior.

Can we redirect it to https://github1s.com/%25

conwnet commented 2 years ago

Can we redirect it to https://github1s.com/%25

I didn't find the way to do this, once we visit the invalid url, vercel returns error immediately.