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

UI: Handle reference names with / #6806

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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