Permanently redirect to /s/... for share links (#4067)

This commit is contained in:
Apoorv Mishra
2022-09-08 13:14:25 +05:30
committed by GitHub
parent c36dcc9712
commit 97f70edd93
12 changed files with 65 additions and 19 deletions

View File

@@ -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]
);