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

Nested 500 page inside a page #24104

Closed
HesterG opened this issue Apr 13, 2023 · 5 comments · Fixed by #24110
Closed

Nested 500 page inside a page #24104

HesterG opened this issue Apr 13, 2023 · 5 comments · Fixed by #24110
Labels

Comments

@HesterG
Copy link
Contributor

HesterG commented Apr 13, 2023

Description

The position of 500 error might be incorrect if an error occurs inside a nested template. In the example below, the error occurs in line 694 of comments.tmpl, and this 500 error page was nested around this place where the error occurs.

default.mov

Steps to reproduce:

  1. Create a team under an organization with the following settings

截屏2023-04-13 17 27 11

  1. Open a pull request and assign the team as the reviewer.

截屏2023-04-13 17 32 27

  1. Delete this team.
  2. Go back to the pull request where this team was formerly assigned.

And the following JS error occurs because when the 500 error page is nested, there will be two head_script.tmpl with webcomponents.js imported twice. This error will be fixed if 500 page is not nested.

截屏2023-04-13 17 47 40

Gitea Version

latest

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

On macOS:

TAGS="bindata sqlite sqlite_unlock_notify" make build
./gitea

Database

None

@HesterG
Copy link
Contributor Author

HesterG commented Apr 13, 2023

Did some check, and I think the issue might come from somewhere around here, but not very sure.

@sillyguodong
Copy link
Contributor

Internal server error is related to #23738 (comment)

@wxiaoguang
Copy link
Contributor

The duplicate <head><script> is caused by backend/template errors. As long as there is no backend error, then there won't be JS error.

@sillyguodong
Copy link
Contributor

The duplicate <head><script> is caused by backend/template errors. As long as there is no backend error, then there won't be JS error.

got it, i will fix the backend error.
close this issue?

@wxiaoguang
Copy link
Contributor

Show friendly 500 error page to users and developers #24110

This PR will help you.

lunny pushed a commit that referenced this issue Apr 14, 2023
Close #24104

This also introduces many tests to cover many complex error handling
functions.

### Before

The details are never shown in production.

<details>

![image](https://user-images.githubusercontent.com/2114189/231805004-13214579-4fbe-465a-821c-be75c2749097.png)

</details>

### After

The details could be shown to site admin users. It is safe.

![image](https://user-images.githubusercontent.com/2114189/231803912-d5660994-416f-4b27-a4f1-a4cc962091d4.png)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants