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(ui): URL Encode all Entity Profile URLs #7023

Merged
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
217 changes: 0 additions & 217 deletions datahub-web-react/src/app/entity/dataset/profile/Documentation.tsx

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function GroupMembersSideBarSection({ total, relationships, onSee
const name = entityRegistry.getDisplayName(EntityType.CorpUser, user);
return (
<MemberTag>
<Link to={`/${entityRegistry.getPathName(EntityType.CorpUser)}/${user.urn}`}>
<Link to={`${entityRegistry.getEntityUrl(EntityType.CorpUser, user.urn)}`}>
<CustomAvatar
name={name}
photoUrl={user.editableProperties?.pictureLink || undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const ExpandedActor = ({ actor, popOver, closable, onClose }: Props) => {

return (
<ActorTag onClose={onClose} closable={closable}>
<Link to={`/${entityRegistry.getPathName(actor.type)}/${actor.urn}`}>
<Link to={`${entityRegistry.getEntityUrl(actor.type, actor.urn)}`}>
<CustomAvatar name={name} photoUrl={pictureLink} useDefaultAvatar={false} />
{(!popOver && <>{name}</>) || (
<Popover overlayStyle={{ maxWidth: 200 }} placement="left" content={popOver}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { useEntityRegistry } from '../../../../useEntityRegistry';
import analytics, { EventType, EntityActionType } from '../../../../analytics';
import { useEntityData } from '../../EntityContext';
import { getDescriptionFromType, getNameFromType } from '../../containers/profile/sidebar/Ownership/ownershipUtils';
import { urlEncodeUrn } from '../../utils';

type Props = {
entityUrn?: string;
Expand Down Expand Up @@ -89,7 +88,7 @@ export const ExpandedOwner = ({ entityUrn, owner, hidePopOver, refetch }: Props)

return (
<OwnerTag onClose={onClose} closable={!!entityUrn}>
<Link to={`/${entityRegistry.getPathName(owner.owner.type)}/${urlEncodeUrn(owner.owner.urn)}`}>
<Link to={`${entityRegistry.getEntityUrl(owner.owner.type, owner.owner.urn)}`}>
<CustomAvatar name={name} photoUrl={pictureLink} useDefaultAvatar={false} />
{(hidePopOver && <>{name}</>) || (
<Popover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ export const LinkList = ({ refetch }: LinkListProps) => {
<>
Added {formatDateString(link.created.time)} by{' '}
<Link
to={`/${entityRegistry.getPathName(EntityType.CorpUser)}/${
link.author.urn
}`}
to={`${entityRegistry.getEntityUrl(EntityType.CorpUser, link.author.urn)}`}
>
{link.author.username}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function NodeItem(props: Props) {
{areChildrenVisible && <StyledDownOutlined onClick={() => setAreChildrenVisible(false)} />}
{!isSelecting && (
<NodeLink
to={`/${entityRegistry.getPathName(node.type)}/${node.urn}`}
to={`${entityRegistry.getEntityUrl(node.type, node.urn)}`}
isSelected={entityData?.urn === node.urn}
>
<StyledFolderOutlined />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function TermItem(props: Props) {
<TermWrapper>
{!isSelecting && (
<TermLink
to={`/${entityRegistry.getPathName(term.type)}/${term.urn}`}
to={`${entityRegistry.getEntityUrl(term.type, term.urn)}`}
isSelected={entityData?.urn === term.urn}
>
{entityRegistry.getDisplayName(term.type, isOnEntityPage ? entityData : term)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function GlossaryEntitiesPath() {
breadcrumbs.map((node) => {
return (
<BreadcrumbItem key={node.urn}>
<Link to={`/${entityRegistry.getPathName(node.type)}/${node.urn}`}>
<Link to={`${entityRegistry.getEntityUrl(node.type, node.urn)}`}>
{entityRegistry.getDisplayName(node.type, node)}
</Link>
</BreadcrumbItem>
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/glossary/GlossaryEntityItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function GlossaryEntityItem(props: Props) {
const entityRegistry = useEntityRegistry();

return (
<Link to={`/${entityRegistry.getPathName(type)}/${urn}`}>
<Link to={`${entityRegistry.getEntityUrl(type, urn)}`}>
<ItemWrapper>
<GlossaryItem>
<span>
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/glossary/GlossarySearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function GlossarySearch() {
{searchResults.map((result) => {
return (
<SearchResult
to={`/${entityRegistry.getPathName(result.entity.type)}/${result.entity.urn}`}
to={`${entityRegistry.getEntityUrl(result.entity.type, result.entity.urn)}`}
onClick={() => setIsSearchBarFocused(false)}
>
<IconWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default function PolicyDetailsModal({ policy, visible, onClose, privilege
<Link
target="_blank"
rel="noopener noreferrer"
to={() => `/${entityRegistry.getPathName(criterionValue.entity!.type)}/${criterionValue.value}`}
to={() => `${entityRegistry.getEntityUrl(criterionValue.entity!.type, criterionValue.value)}`}
>
{getDisplayName(criterionValue.entity)}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export default function PolicyPrivilegeForm({
<Link
target="_blank"
rel="noopener noreferrer"
to={() => `/${entityRegistry.getPathName(result.entity.type)}/${result.entity.urn}`}
to={() => `${entityRegistry.getEntityUrl(result.entity.type, result.entity.urn)}`}
>
View
</Link>
Expand Down