Permanently redirect to /s/... for share links (#4067)
This commit is contained in:
14
app/utils/routeHelpers.test.ts
Normal file
14
app/utils/routeHelpers.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { sharedDocumentPath } from "./routeHelpers";
|
||||
|
||||
describe("#sharedDocumentPath", () => {
|
||||
test("should return share path for a document", () => {
|
||||
const shareId = "1c922644-40d8-41fe-98f9-df2b67239d45";
|
||||
const docPath = "/doc/test-DjDlkBi77t";
|
||||
expect(sharedDocumentPath(shareId)).toBe(
|
||||
"/s/1c922644-40d8-41fe-98f9-df2b67239d45"
|
||||
);
|
||||
expect(sharedDocumentPath(shareId, docPath)).toBe(
|
||||
"/s/1c922644-40d8-41fe-98f9-df2b67239d45/doc/test-DjDlkBi77t"
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -117,6 +117,10 @@ export function searchPath(
|
||||
return `${route}${search}`;
|
||||
}
|
||||
|
||||
export function sharedDocumentPath(shareId: string, docPath?: string) {
|
||||
return docPath ? `/s/${shareId}${docPath}` : `/s/${shareId}`;
|
||||
}
|
||||
|
||||
export function notFoundUrl(): string {
|
||||
return "/404";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user