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

Fix a bug returning 404 when display a single tag with no release #29466

Merged
merged 11 commits into from
Mar 2, 2024

Conversation

lunny
Copy link
Member

@lunny lunny commented Feb 28, 2024

Partially caused by #29149

When use

releases, err := getReleaseInfos(ctx, &repo_model.FindReleasesOptions{
		ListOptions: db.ListOptions{Page: 1, PageSize: 1},
		RepoID:      ctx.Repo.Repository.ID,
		TagNames:    []string{ctx.Params("*")},
		// only show draft releases for users who can write, read-only users shouldn't see draft releases.
		IncludeDrafts: writeAccess,
	})

replace

release, err := repo_model.GetRelease(ctx, ctx.Repo.Repository.ID, ctx.Params("*"))

It missed IncludeTags: true,. That means this bug will be occupied only when the release is only a tag.

  • Get the right tag record when it's not a release
  • Display correct tag tab but not release tag when it's a tag.
  • The button will bring the tag name to the new page when it's a single tag page
  • the new page will automatically hide the release target inputbox when the tag name is pre filled. This should be backport to v1.21.

@lunny lunny added type/bug skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Feb 28, 2024
@lunny lunny requested a review from KN4CK3R February 28, 2024 03:46
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 28, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 28, 2024
…d bug when there is a prefix tag name on creating release
@pull-request-size pull-request-size bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 28, 2024
@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 Feb 28, 2024
@KN4CK3R
Copy link
Member

KN4CK3R commented Feb 28, 2024

Could you have a look at the title too?
grafik
This does not look good for tags without release:

<h4 class="release-list-title gt-word-break">
<a href="{{$.RepoLink}}/releases/tag/{{$release.TagName | PathEscapeSegments}}">{{$release.Title}}</a>
{{template "repo/commit_statuses" dict "Status" $info.CommitStatus "Statuses" $info.CommitStatuses "AdditionalClasses" "gt-df"}}
{{if $release.IsDraft}}
<span class="ui yellow label">{{ctx.Locale.Tr "repo.release.draft"}}</span>
{{else if $release.IsPrerelease}}
<span class="ui orange label">{{ctx.Locale.Tr "repo.release.prerelease"}}</span>
{{else}}
<span class="ui green label">{{ctx.Locale.Tr "repo.release.stable"}}</span>
{{end}}
</h4>

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 2, 2024
@lunny
Copy link
Member Author

lunny commented Mar 2, 2024

Could you have a look at the title too? grafik This does not look good for tags without release:

<h4 class="release-list-title gt-word-break">
<a href="{{$.RepoLink}}/releases/tag/{{$release.TagName | PathEscapeSegments}}">{{$release.Title}}</a>
{{template "repo/commit_statuses" dict "Status" $info.CommitStatus "Statuses" $info.CommitStatuses "AdditionalClasses" "gt-df"}}
{{if $release.IsDraft}}
<span class="ui yellow label">{{ctx.Locale.Tr "repo.release.draft"}}</span>
{{else if $release.IsPrerelease}}
<span class="ui orange label">{{ctx.Locale.Tr "repo.release.prerelease"}}</span>
{{else}}
<span class="ui green label">{{ctx.Locale.Tr "repo.release.stable"}}</span>
{{end}}
</h4>

Fixed in b7dc094

@lunny lunny added this to the 1.22.0 milestone Mar 2, 2024
Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really LGTM (too many "if" tricks), but since there is a bug and the bug needs to be fixed.

@GiteaBot GiteaBot removed the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 2, 2024
@GiteaBot GiteaBot added the lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. label Mar 2, 2024
@lunny lunny enabled auto-merge (squash) March 2, 2024 13:21
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 2, 2024
@lunny lunny merged commit cc27b50 into go-gitea:main Mar 2, 2024
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 2, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 2, 2024
* upstream/main:
  Fix a bug returning 404 when display a single tag with no release (go-gitea#29466)
  Add a check for when the command is canceled by the program on Window… (go-gitea#29538)
  Fix incorrect redirection when creating a PR fails (go-gitea#29537)
  Fix incorrect subpath in links (go-gitea#29535)
  Fix issue link does not support quotes (go-gitea#29484) (go-gitea#29487)
@lunny lunny deleted the lunny/fix_tag_404 branch March 5, 2024 08:06
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants