From 0ad36f5cd8e17fb2972eb454d9189c697ab7d12a Mon Sep 17 00:00:00 2001 From: Vitalie Miron Date: Fri, 17 Jan 2025 14:14:17 +0200 Subject: [PATCH] Fix: Add missing Google bot variants to bot detection - Include Google-InspectionTool - Include Google-CloudVertexBot - Include Google-Other Resolves #75032 --- packages/next/src/shared/lib/router/utils/is-bot.ts | 2 +- .../metadata-streaming-config.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/next/src/shared/lib/router/utils/is-bot.ts b/packages/next/src/shared/lib/router/utils/is-bot.ts index 019a09f90024c..0aec28fe7e4f7 100644 --- a/packages/next/src/shared/lib/router/utils/is-bot.ts +++ b/packages/next/src/shared/lib/router/utils/is-bot.ts @@ -5,7 +5,7 @@ const HEADLESS_BROWSER_BOT_UA_RE = // This regex contains the bots that we need to do a blocking render for and can't safely stream the response // due to how they parse the DOM. For example, they might explicitly check for metadata in the `head` tag, so we can't stream metadata tags after the `head` was sent. export const HTML_LIMITED_BOT_UA_RE_STRING = - 'Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview' + 'Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Google-InspectionTool|Google-CloudVertexBot|GoogleOther' export const HTML_LIMITED_BOT_UA_RE = new RegExp( HTML_LIMITED_BOT_UA_RE_STRING, diff --git a/test/production/app-dir/metadata-streaming-config/metadata-streaming-config.test.ts b/test/production/app-dir/metadata-streaming-config/metadata-streaming-config.test.ts index ae24f713e56d4..63613dc5b7ec3 100644 --- a/test/production/app-dir/metadata-streaming-config/metadata-streaming-config.test.ts +++ b/test/production/app-dir/metadata-streaming-config/metadata-streaming-config.test.ts @@ -15,7 +15,7 @@ describe('app-dir - metadata-streaming-config', () => { expect( requiredServerFiles.config.experimental.htmlLimitedBots ).toMatchInlineSnapshot( - `"Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview"` + `"Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Google-InspectionTool|Google-CloudVertexBot|GoogleOther"` ) const responseConfigManifest = JSON.parse( @@ -24,7 +24,7 @@ describe('app-dir - metadata-streaming-config', () => { expect(responseConfigManifest).toMatchInlineSnapshot(` { - "htmlLimitedBots": "Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview", + "htmlLimitedBots": "Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Google-InspectionTool|Google-CloudVertexBot|GoogleOther", "version": 0, } `)