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

Opening Github /raw links doesn't work #492

Closed
musabkilic opened this issue Sep 25, 2020 · 4 comments
Closed

Opening Github /raw links doesn't work #492

musabkilic opened this issue Sep 25, 2020 · 4 comments

Comments

@musabkilic
Copy link
Contributor

Hi! I was working on this issue on the 18S191 repository and I realized that the links in the form of github.com / author / repo / raw / ..... , doesn't open.

I believe the problem can be solved by removing the "/raw" part from the URL path similar to what Pluto already does to /blob links.

} else if (u.host === "github.com") {
u.host = "raw.githubusercontent.com"
u.pathname = u.pathname.replace("/blob", "")
}

@fonsp
Copy link
Owner

fonsp commented Sep 26, 2020

What is a /raw link?

@musabkilic
Copy link
Contributor Author

/blob https://github.com/fonsp/Pluto.jl/blob/master/sample/Basic.jl
/raw https://github.com/fonsp/Pluto.jl/raw/master/sample/Basic.jl

I'm referring the normal Github interface webpage as a /blob link, and the raw file as a /raw link. A /raw link redirects to https://raw.githubusercontent.com. Sorry if my wording/naming is confusing.

@fonsp
Copy link
Owner

fonsp commented Sep 26, 2020

If this is already a raw link, then it already works, right? You can paste any link to a .jl file, there are just 2 special cases to turn github links into raw links.

@musabkilic
Copy link
Contributor Author

That's what I and I think presumably @zmoon thought, too. And I started changing the links in the 18S191 website to sent a pull request and before sending one I tried and I saw that Pluto doesn't work the way I thought it would.

Here is how Pluto handles https://github.com/fonsp/Pluto.jl/raw/master/sample/Basic.jl .

1- It detects that this is a github.com link
2- Replaces github.com part with raw.githubusercontent.com
3- There is no /blob part so we are done

Then Pluto tries to open https://raw.githubusercontent.com/fonsp/Pluto.jl/raw/master/sample/Basic.jl but Github returns 404 error because this is an invalid link. The correct link is at https://raw.githubusercontent.com/fonsp/Pluto.jl/master/sample/Basic.jl, notice the /raw part missing.

} else if (u.host === "github.com") {
u.host = "raw.githubusercontent.com"
u.pathname = u.pathname.replace("/blob", "")
}

@fonsp fonsp closed this as completed Sep 27, 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