-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
PANIC: index out of range when viewing org file in repository #4982
Comments
It looks like Gitea fails to render if goorgeous fails to parse. I pushed a simpler test.org file and it rendered fine. |
This is an upstream issue: curiouslychase/_goorgeous#82 Goorgeous cannot parse org files with empty headerlines. |
Ok, although the original cause of this bug is in an upstream library - now that we know about it we should recover from panics within that library and just render the text with an error. See https://blog.golang.org/defer-panic-and-recover We should also have a root handler for Macaron that does a similar recover and returns a gitea 500. Probably with two different levels of information depending on the production mode. (I.e. report stack trace or not) |
@zeripath There is already a handler for recovery. I believe the application should keep on gitea/routers/routes/routes.go Line 55 in a967cf9
https://github.com/go-macaron/docs/blob/master/en-US/middlewares/core_services.md |
Ah but that is not good enough - the user gets a blank page. |
colleagues, and you can make the file appear just text, |
This PR protects against the panic referred to in chaseadmsio/goorgeous#82 by recovering from the panic and just returning the raw bytes if there is an error. Signed-off-by: Andrew Thornton <[email protected]>
I'm removing the |
There is also this open issue that suggests replacing goorgeous with another library. |
This PR protects against the panic referred to in chaseadmsio/goorgeous#82 by recovering from the panic and just returning the raw bytes if there is an error. Signed-off-by: Andrew Thornton <[email protected]>
…tea#5903) This PR protects against the panic referred to in chaseadmsio/goorgeous#82 by recovering from the panic and just returning the raw bytes if there is an error. Signed-off-by: Andrew Thornton <[email protected]>
This PR protects against the panic referred to in chaseadmsio/goorgeous#82 by recovering from the panic and just returning the raw bytes if there is an error. Signed-off-by: Andrew Thornton <[email protected]>
[x]
):Description
I checked in an org file to a private repository. I'm able to pull the file and view the diff but rendering it in the web view produces a blank page and stack trace.
The text was updated successfully, but these errors were encountered: