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

@@ -8,19 +8,19 @@ afterAll(server.disconnect);
beforeEach(db.flush);
describe("/share/:id", () => {
describe("/s/:id", () => {
it("should return standard title in html when loading unpublished share", async () => {
const share = await buildShare({
published: false,
});
const res = await server.get(`/share/${share.id}`);
const res = await server.get(`/s/${share.id}`);
const body = await res.text();
expect(res.status).toEqual(404);
expect(body).toContain("<title>Outline</title>");
});
it("should return standard title in html when share does not exist", async () => {
const res = await server.get(`/share/junk`);
const res = await server.get(`/s/junk`);
const body = await res.text();
expect(res.status).toEqual(404);
expect(body).toContain("<title>Outline</title>");
@@ -33,7 +33,7 @@ describe("/share/:id", () => {
teamId: document.teamId,
});
await document.destroy();
const res = await server.get(`/share/${share.id}`);
const res = await server.get(`/s/${share.id}`);
const body = await res.text();
expect(res.status).toEqual(404);
expect(body).toContain("<title>Outline</title>");
@@ -45,7 +45,7 @@ describe("/share/:id", () => {
documentId: document.id,
teamId: document.teamId,
});
const res = await server.get(`/share/${share.id}`);
const res = await server.get(`/s/${share.id}`);
const body = await res.text();
expect(res.status).toEqual(200);
expect(body).toContain(`<title>${document.title}</title>`);
@@ -57,7 +57,7 @@ describe("/share/:id", () => {
documentId: document.id,
teamId: document.teamId,
});
const res = await server.get(`/share/${share.id}/doc/${document.urlId}`);
const res = await server.get(`/s/${share.id}/doc/${document.urlId}`);
const body = await res.text();
expect(res.status).toEqual(200);
expect(body).toContain(`<title>${document.title}</title>`);