Permanently redirect to /s/... for share links (#4067)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as React from "react";
|
||||
import Breadcrumb from "~/components/Breadcrumb";
|
||||
import { MenuInternalLink, NavigationNode } from "~/types";
|
||||
import { sharedDocumentPath } from "~/utils/routeHelpers";
|
||||
|
||||
type Props = {
|
||||
documentId: string;
|
||||
@@ -48,7 +49,11 @@ const PublicBreadcrumb: React.FC<Props> = ({
|
||||
pathToDocument(sharedTree, documentId)
|
||||
.slice(0, -1)
|
||||
.map((item) => {
|
||||
return { ...item, type: "route", to: `/share/${shareId}${item.url}` };
|
||||
return {
|
||||
...item,
|
||||
type: "route",
|
||||
to: sharedDocumentPath(shareId, item.url),
|
||||
};
|
||||
}),
|
||||
[sharedTree, shareId, documentId]
|
||||
);
|
||||
|
||||
@@ -9,6 +9,7 @@ import EmojiIcon from "~/components/EmojiIcon";
|
||||
import Flex from "~/components/Flex";
|
||||
import { hover } from "~/styles";
|
||||
import { NavigationNode } from "~/types";
|
||||
import { sharedDocumentPath } from "~/utils/routeHelpers";
|
||||
|
||||
type Props = {
|
||||
shareId?: string;
|
||||
@@ -64,7 +65,9 @@ function ReferenceListItem({
|
||||
return (
|
||||
<DocumentLink
|
||||
to={{
|
||||
pathname: shareId ? `/share/${shareId}${document.url}` : document.url,
|
||||
pathname: shareId
|
||||
? sharedDocumentPath(shareId, document.url)
|
||||
: document.url,
|
||||
hash: anchor ? `d-${anchor}` : undefined,
|
||||
state: {
|
||||
title: document.title,
|
||||
|
||||
Reference in New Issue
Block a user