Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0a32e0

Browse files
authored
fix(site): do not render invalid task status URI, fix GitHub new links (#20858)
Fixes#20429
1 parent2a9afc7 commite0a32e0

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

‎site/src/pages/TaskPage/TaskStatusLink.stories.tsx‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ const meta: Meta<typeof TaskStatusLink> = {
1717
exportdefaultmeta;
1818
typeStory=StoryObj<typeofTaskStatusLink>;
1919

20+
exportconstGitHubNewPR:Story={
21+
args:{
22+
uri:"https://github.com/coder/coder/pull/new/fix-deleted-template-button",
23+
},
24+
};
25+
2026
exportconstGithubPRNumber:Story={
2127
args:{
2228
uri:"https://github.com/org/repo/pull/1234",
@@ -29,6 +35,12 @@ export const GitHubPRNoNumber: Story = {
2935
},
3036
};
3137

38+
exportconstGitHubNewIssue:Story={
39+
args:{
40+
uri:"https://github.com/coder/coder/issues/new?template=BLANK_ISSUE",
41+
},
42+
};
43+
3244
exportconstGithubIssueNumber:Story={
3345
args:{
3446
uri:"https://github.com/org/repo/issues/4321",
@@ -70,3 +82,15 @@ export const Long: Story = {
7082
uri:"https://dev.coder.com/this-is-a/long-url/to-test/how-the-truncation/looks",
7183
},
7284
};
85+
86+
exportconstInvalidPathNotRendered:Story={
87+
args:{
88+
uri:"/path/to/foo",
89+
},
90+
};
91+
92+
exportconstInvalidRelativePathNotRendered:Story={
93+
args:{
94+
uri:"path/to/foo",
95+
},
96+
};

‎site/src/pages/TaskPage/TaskStatusLink.tsx‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,21 @@ export const TaskStatusLink: FC<TaskStatusLinkProps> = ({ uri }) => {
3030
switch(type){
3131
case"pull":
3232
icon=<GitPullRequestArrowIcon/>;
33-
label=number
34-
?`${org}/${repo}#${number}`
35-
:`${org}/${repo} pull request`;
33+
label=
34+
number==="new"
35+
?`${org}/${repo} open pull request`
36+
:number
37+
?`${org}/${repo}#${number}`
38+
:`${org}/${repo} pull request`;
3639
break;
3740
case"issues":
3841
icon=<BugIcon/>;
39-
label=number
40-
?`${org}/${repo}#${number}`
41-
:`${org}/${repo} issue`;
42+
label=
43+
number==="new"
44+
?`${org}/${repo} create new issue`
45+
:number
46+
?`${org}/${repo}#${number}`
47+
:`${org}/${repo} issue`;
4248
break;
4349
default:
4450
icon=<ExternalImagesrc="/icon/github.svg"/>;
@@ -52,6 +58,7 @@ export const TaskStatusLink: FC<TaskStatusLinkProps> = ({ uri }) => {
5258
}
5359
}catch(_error){
5460
// Invalid URL, probably.
61+
returnnull;
5562
}
5663

5764
return(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp