toeverything/AFFiNE · error

Invalid Google Drive iframe URL:

Error message

Invalid Google Drive iframe URL:

What it means

Warning logged in `isValidGoogleDriveIframeUrl` when `new URL(url)` throws because the candidate URL is malformed. The function returns false, so the URL is treated as an invalid Google Drive embed and filtered out of the provider config — a validation guard against unparseable user input.

Source

Thrown at blocksuite/affine/blocks/embed/src/embed-iframe-block/configs/providers/google-drive.ts:134

function isValidGoogleDriveIframeUrl(url: string): boolean {
  try {
    if (!validateEmbedIframeUrl(url, googleDriveUrlValidationOptions)) {
      return false;
    }

    const parsedUrl = new URL(url);
    const pathSegments = parsedUrl.pathname.split('/').filter(Boolean);

    if (isValidGoogleDriveFileUrl(parsedUrl)) {
      return pathSegments[3] === 'preview';
    }

    return (
      parsedUrl.pathname === '/embeddedfolderview' &&
      !!parsedUrl.searchParams.get('id')
    );
  } catch (e) {
    console.warn('Invalid Google Drive iframe URL:', e);
    return false;
  }
}

/**
 * Build embed URL for Google Drive files
 * @param fileId File ID
 * @returns Embed URL
 */
function buildGoogleDriveFileEmbedUrl(fileId: string): string | undefined {
  const embedUrl = new URL(
    'preview',
    `${GOOGLE_DRIVE_EMBED_FILE_URL}${fileId}/`
  );
  embedUrl.searchParams.set('usp', 'embed_googleplus');
  return embedUrl.toString();
}

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Use a valid Google Drive share/embed URL.
  2. Copy the embed URL from Google Drive's share dialog.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Triggered when new URL() throws while checking whether a Google Drive iframe URL is a valid preview or embedded folder URL, so the check returns false.

Common situations: Occurs when a user supplies a malformed Google Drive link to the embed iframe block. Paste a valid drive.google.com share URL instead.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/548aab282c2eba56. Report an issue: GitHub.