toeverything/AFFiNE · error
Failed to parse Google Drive path URL:
Error message
Failed to parse Google Drive path URL:
What it means
Warning logged in `buildGoogleDriveEmbedUrl` when constructing the embed URL fails — usually `new URL(url)` throwing on a malformed path URL, or a URL shape that matches no supported Google Drive pattern. Returns undefined so the URL is not converted into a Google Drive iframe embed.
Source
Thrown at blocksuite/affine/blocks/embed/src/embed-iframe-block/configs/providers/google-drive.ts:192
// Should have at least 2 segments
if (pathSegments.length < 2) {
return undefined;
}
// Handle file URL: /file/d/file-id/view
if (isValidGoogleDriveFileUrl(parsedUrl)) {
return buildGoogleDriveFileEmbedUrl(pathSegments[2]);
}
// Handle folder URL: /drive/folders/folder-id
if (isValidGoogleDriveFolderUrl(parsedUrl)) {
return buildGoogleDriveFolderEmbedUrl(pathSegments[2]);
}
return undefined;
} catch (e) {
console.warn('Failed to parse Google Drive path URL:', e);
return undefined;
}
}
export const googleDriveConfig = {
name: 'google-drive',
match: (url: string) => isValidGoogleDriveUrl(url),
buildOEmbedUrl: (url: string) => {
if (!isValidGoogleDriveUrl(url)) {
return undefined;
}
// If is a valid google drive url, build the embed url
return buildGoogleDriveEmbedUrl(url);
},
useOEmbedUrlDirectly: true,
validateIframeUrl: (iframeUrl: string) =>
isValidGoogleDriveIframeUrl(iframeUrl),View on GitHub (pinned to b4c8548c09)
Solutions
- Use a standard Google Drive file URL.
- Re-copy the link from Google Drive.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Triggered when parsing a Google Drive path URL fails with an exception inside the try block, so buildGoogleDriveEmbedUrl returns undefined instead of an embed URL.
Common situations: Occurs when a user pastes a malformed or nonstandard Google Drive link into the embed iframe block. Use a standard file or folder share URL from Google Drive.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/5fdc525f4fabc2e0.
Report an issue: GitHub.