Skip to content

Correctly handle submodule view and avoid throwing 500 error #34121

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

Merged
merged 3 commits into from
Apr 6, 2025

Conversation

wxiaoguang
Copy link
Contributor

Before: Gitea reports 500 error when viewing a submodule path directly.

After: auto-redirect for in-site links, and show 404 for external links (to avoid open redirect or phishing)


Actually such "submodule" link is never constructed by Gitea's code, just in case some end users manually construct that link.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 4, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 4, 2025
@wxiaoguang
Copy link
Contributor Author

Before the fix:

image

@wxiaoguang wxiaoguang added this to the 1.24.0 milestone Apr 4, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 4, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 6, 2025
@wxiaoguang wxiaoguang enabled auto-merge (squash) April 6, 2025 09:14
@wxiaoguang wxiaoguang merged commit e94f8d5 into go-gitea:main Apr 6, 2025
26 checks passed
@wxiaoguang wxiaoguang deleted the fix-submodule-view branch April 6, 2025 09:46
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 8, 2025
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  docs: add Chinese translations for README files (go-gitea#34132)
  Keep file tree view icons consistent with icon theme (go-gitea#33921)
  Make markdown render match GitHub's behavior (go-gitea#34129)
  Remove dead code: RepoRef (go-gitea#34131)
  Correctly handle submodule view and avoid throwing 500 error (go-gitea#34121)
  Use `overflow-wrap: anywhere` to replace `word-break: break-all` (go-gitea#34126)
  Fix markdown render behaviors (go-gitea#34122)
  Refactor dropdown ellipsis (go-gitea#34123)
  Avoid creating unnecessary temporary cat file sub process (go-gitea#33942)
  Fix discord webhook 400 status code when description limit is exceeded (go-gitea#34084)
  Refactor markup render to fix various path problems (go-gitea#34114)
  [skip ci] Updated translations via Crowdin
  Fix invalid version in RPM package path (go-gitea#34112)
  also check default ssh-cert location for host (go-gitea#34099) (go-gitea#34100)
  Fix markdown frontmatter rendering (go-gitea#34102)
  Get changed files based on merge base when checking `pull_request` actions trigger (go-gitea#34106)
  Add `last_committer_date` and `last_author_date` for file contents API (go-gitea#32921)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants