Add support for extracting Google Doc ID from /preview URLs in parse.ts.

This commit is contained in:
MartinBraquet
2026-04-29 20:45:27 +02:00
parent a62be51885
commit 87ec4a7bc3
2 changed files with 2 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@compass/api",
"version": "1.36.2",
"version": "1.36.3",
"private": true,
"description": "Backend API endpoints",
"main": "src/serve.ts",

View File

@@ -524,6 +524,7 @@ function cleanHref(href: string): string {
export function extractGoogleDocId(url: string) {
const patterns = [
/\/document\/d\/([a-zA-Z0-9-_]+)\/edit/, // standard /d/{id}/edit format
/\/document\/d\/([a-zA-Z0-9-_]+)\/preview/, // standard /d/{id}/preview format
// /id=([a-zA-Z0-9-_]+)/, // ?id= query param format (catches false negatives)
// /^([a-zA-Z0-9-_]+)$/, // raw ID passed directly (catches false negatives)
]