Skip to content

Commit

Permalink
Fix incorrect subpath in links (go-gitea#29535) (go-gitea#29541)
Browse files Browse the repository at this point in the history
Backport go-gitea#29535 by wxiaoguang

* `$referenceUrl`: it is constructed by "Issue.Link", which already has
the "AppSubURL"
* `window.location.href`: AppSubURL could be empty string, so it needs
the trailing slash

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
  • Loading branch information
GiteaBot and wxiaoguang authored Mar 2, 2024
1 parent 3a8877c commit 401cc39
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion templates/repo/diff/comments.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<div class="comment-header-right actions gt-df gt-ac">
{{if .Invalidated}}
{{$referenceUrl := printf "%s#%s" $.root.Issue.Link .HashTag}}
<a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
<a href="{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
</a>
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/diff/conversation.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
We only handle the case $resolved=true and $invalid=true in this template because if the comment is not resolved it has the outdated label in the comments area (not the header above).
The case $resolved=false and $invalid=true is handled in repo/diff/comments.tmpl
-->
<a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
<a href="{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
</a>
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export function initNotificationCount() {
type: 'close',
});
worker.port.close();
window.location.href = appSubUrl;
window.location.href = `${appSubUrl}/`;
} else if (event.data.type === 'close') {
worker.port.postMessage({
type: 'close',
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/stopwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function initStopwatch() {
type: 'close',
});
worker.port.close();
window.location.href = appSubUrl;
window.location.href = `${appSubUrl}/`;
} else if (event.data.type === 'close') {
worker.port.postMessage({
type: 'close',
Expand Down

0 comments on commit 401cc39

Please sign in to comment.