Skip to content

Commit

Permalink
UI: Handle reference names with /
Browse files Browse the repository at this point in the history
Fixes #6802
  • Loading branch information
snazy committed May 11, 2023
1 parent 744a7e3 commit f5bf2b7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const updateRef = (
const view = locationParts[0];

if (view === "commits" || view === "tree" || view === "content") {
const branch = locationParts[1];
const branch = decodeURIComponent(locationParts[1]);
const slug =
locationParts.length > 2 ? locationParts.slice(2).join("/") : "";

Expand Down
4 changes: 2 additions & 2 deletions ui/src/CommitLog/CommitLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const CommitLog = ({
<div>
<Nav.Item>
<ExploreLink
toRef={branch}
toRef={encodeURIComponent(branch)}
path={(hash ?? "#").split("/")}
type="COMMIT"
className="commitLog__messageLink"
Expand All @@ -103,7 +103,7 @@ const CommitLog = ({
</Button>
</Tooltip>
<ExploreLink
toRef={branch}
toRef={encodeURIComponent(branch)}
path={(hash ?? "#").split("/")}
type="COMMIT"
className="commitLog__hashBtn rightBtnHover"
Expand Down
21 changes: 13 additions & 8 deletions ui/src/TableHead/TableHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const BranchesDropdown = ({
{branches.map((branch) => {
return (
<ExploreLink
toRef={branch.name}
toRef={encodeURIComponent(branch.name)}
path={path}
type={type}
key={branch.name}
Expand All @@ -80,7 +80,12 @@ const BranchesDropdown = ({
<NavDropdown.Item disabled>Tags</NavDropdown.Item>
{tags.map((tag) => {
return (
<ExploreLink toRef={tag.name} path={path} type={type} key={tag.name}>
<ExploreLink
toRef={encodeURIComponent(tag.name)}
path={path}
type={type}
key={tag.name}
>
<NavDropdown.Item as={"button"} key={tag.name}>
{tag.name}
</NavDropdown.Item>
Expand Down Expand Up @@ -129,7 +134,7 @@ const TreeTableHead = ({
</div>
<Nav.Item className="tableHead__rightContentWrapper">
<ExploreLink
toRef={currentRef}
toRef={encodeURIComponent(currentRef)}
path={path || []}
type="COMMIT"
className="nav-link"
Expand All @@ -155,7 +160,7 @@ const PathTableHead = ({
}: PathTableHeadProps): React.ReactElement => {
return (
<Nav.Item className="nav-link">
<ExploreLink toRef={currentRef}>nessie</ExploreLink>
<ExploreLink toRef={encodeURIComponent(currentRef)}>nessie</ExploreLink>
{path.map((p, index) => {
return (
<Fragment key={`path${index}`}>
Expand All @@ -164,7 +169,7 @@ const PathTableHead = ({
</span>
<ExploreLink
key={index}
toRef={currentRef}
toRef={encodeURIComponent(currentRef)}
path={(path || []).slice(0, index + 1)}
>
{p}
Expand All @@ -182,9 +187,9 @@ const PathCommitTableHead = ({
}: PathTableHeadProps): React.ReactElement => {
return (
<Nav.Item className="nav-link">
<ExploreLink toRef={currentRef}>nessie</ExploreLink>
<ExploreLink toRef={encodeURIComponent(currentRef)}>nessie</ExploreLink>
<span style={{ paddingLeft: "0.5em", paddingRight: "0.5em" }}>/</span>
<ExploreLink toRef={currentRef} type={"COMMIT"}>
<ExploreLink toRef={encodeURIComponent(currentRef)} type={"COMMIT"}>
commits
</ExploreLink>
{path.map((p, index) => {
Expand All @@ -195,7 +200,7 @@ const PathCommitTableHead = ({
</span>
<ExploreLink
key={index}
toRef={currentRef}
toRef={encodeURIComponent(currentRef)}
path={(path || []).slice(0, index + 1)}
type={"COMMIT"}
>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/TableListing/TableListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const groupItem = (
return (
<ListGroupItem key={key.name}>
<ExploreLink
toRef={ref}
toRef={encodeURIComponent(ref)}
path={path.concat(key.name)}
type={key.type === "CONTAINER" ? "CONTAINER" : "OBJECT"}
>
Expand Down

0 comments on commit f5bf2b7

Please sign in to comment.