-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #930 from MuckRock/928-page-link
Adds redirects for other old embed routes
- Loading branch information
Showing
6 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/routes/(app)/documents/[id]-[slug]/annotations/[note_id]/+page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// this route was sometimes generated by old embeds and should redirect | ||
|
||
import { redirect } from "@sveltejs/kit"; | ||
import { EMBED_URL } from "@/config/config.js"; | ||
|
||
export function load({ params }) { | ||
const { id, note_id } = params; | ||
|
||
// the embed route can handle errors | ||
const url = new URL( | ||
`/documents/${id}/annotations/${note_id}/?embed=1`, | ||
EMBED_URL, | ||
); | ||
|
||
return redirect(302, url); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/routes/(app)/documents/[id]-[slug]/pages/[page]/+page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// this route was sometimes generated by old embeds and should redirect | ||
|
||
import { redirect } from "@sveltejs/kit"; | ||
import { EMBED_URL } from "@/config/config.js"; | ||
|
||
export function load({ params }) { | ||
const { id, page } = params; | ||
|
||
// if this is a 404, the embed route will handle it | ||
const url = new URL(`/documents/${id}/pages/${page}/?embed=1`, EMBED_URL); | ||
|
||
return redirect(302, url); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters