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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML pages are rendered in raw mode #2283
Comments
Can you reproduce this on https://try.gogs.io ? |
Yeah! Here is! 馃憤 |
Thanks! How does GitHub handles it? I think this is expected behavior. Gogs does not give any assumption for raw format of content, and browser determines it automatically. Since you use |
Yeah, I thought same, but GitHub use the For example, a web page in RAW mode in GitHub |
How do you know? |
So, the HTML text isn't interpreted by browser 馃憤 |
I see. I think GitHub only does this for |
I think that for all of them. I'm just see that javascript and php text use it too. |
OK... I think it involves something else bigger... I believe if you do |
It's possible! |
how about this: func ServeData(ctx *middleware.Context, name string, reader io.Reader) error {
buf := make([]byte, 1024)
n, _ := reader.Read(buf)
if n > 0 {
buf = buf[:n]
}
_, isTextFile := base.IsTextFile(buf)
if !isTextFile {
_, isImageFile := base.IsImageFile(buf)
if !isImageFile {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
}
} else {
ctx.Resp.Header().Set("Content-Type", "text/plain; charset=utf-8") // <<<<<<
}
ctx.Resp.Write(buf)
_, err := io.Copy(ctx.Resp, reader)
return err
} |
@xxxTonixxx I think it is a feature of the browser(FF/IE/Chrome), not github |
@novaeye Hmmm, It's true that in source code doesn't appear the |
It's ok! but... There is a problem with encoding characters (谩茅铆贸煤...).
|
Github raw view serves files with There's a services that serve files from Github with proper content type headers: https://rawgit.com Maybe in Gogs we could have a URL parameter to it: (I think it should default to false if not provided so something like |
That will be interesnting 馃憤, but... to work from the address bar doesn't think that it's the best way... |
@xxxTonixxx your screenshots more like browser auto-detection thing for me. My Chrome show what I expect: |
Ok! I already have changed and right now it's working... but, it's strange that with GitHub's raw mode was working without I change nothing... With Firefox was equal but with IE is working good! Thank you!!! 馃槃 馃憤 |
@xxxTonixxx GitHub may do encoding transformation, but Gogs serves "raw" from Git blob. |
what if somebody want a raw html rendered. To get something like gitpages, or so. Use case: |
@pykiss Hmm... maybe you can file another issue and ask likes |
What does this mean specifically? |
sry, for bad wording. Until last release while looking at the raw file type i got my rendered html. Now, because it is wrapped into another html it is broken and I get the view above. |
@tkschmidt OK.. I think this is intended to not render. You may want to follow up on #2593 |
Still unsolved? I wget a python file via its raw url, but the downloaded file is in html format ??????? |
When I show a HTML file in RAW mode, this doesn't show its code, this is being rendering when It mustn't be so.
Saludos! 馃憤
The text was updated successfully, but these errors were encountered: