From d21c952bd88c0cd9dabef47e1525a665af526424 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 30 Oct 2023 11:28:11 -0400 Subject: [PATCH 1/3] Unbreak lots of missing data Liquid tags (#45328) --- lib/correct-translation-content.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/correct-translation-content.js b/lib/correct-translation-content.js index 38948322f6..45c23fbe04 100644 --- a/lib/correct-translation-content.js +++ b/lib/correct-translation-content.js @@ -24,6 +24,7 @@ export function correctTranslatedContentStrings(content, englishContent, context if (context.code === 'ru') { // We've seen a lot of these in the Russian translations: content = content.replaceAll('{% данных variables', '{% data variables') + content = content.replaceAll('{% variables.', '{% data variables.') // For the rather custom Russian translation of // the content/get-started/quickstart/github-glossary.md page From 48376430211e40a5a6f39b05034a8c43af42ea28 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 30 Oct 2023 11:28:24 -0400 Subject: [PATCH 2/3] Fix link checker for relative image references (#45203) --- src/links/scripts/rendered-content-link-checker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/links/scripts/rendered-content-link-checker.js b/src/links/scripts/rendered-content-link-checker.js index 8c6a55477d..61d807e36f 100755 --- a/src/links/scripts/rendered-content-link-checker.js +++ b/src/links/scripts/rendered-content-link-checker.js @@ -1031,7 +1031,13 @@ function getRetryAfterSleep(headerValue) { } function checkImageSrc(src, $) { + if (!src.startsWith('/') && !src.startsWith('http')) { + return { CRITICAL: 'Image path is not absolute. Should start with a /' } + } const pathname = new URL(src, 'http://example.com').pathname + if (pathname.startsWith('http://')) { + return { CRITICAL: "Don't use insecure HTTP:// for external images" } + } if (!pathname.startsWith('/')) { return { WARNING: "External images can't not be checked" } } From 0d34fecbd7bb7bad24d4111b9262e052c63b2e0d Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 30 Oct 2023 11:28:39 -0400 Subject: [PATCH 3/3] Index title and content with with position offsets to be able to use `fvh` (#45175) --- src/search/scripts/index-elasticsearch.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/search/scripts/index-elasticsearch.js b/src/search/scripts/index-elasticsearch.js index 98f2848b0e..64a0432c00 100755 --- a/src/search/scripts/index-elasticsearch.js +++ b/src/search/scripts/index-elasticsearch.js @@ -339,9 +339,22 @@ async function indexVersion(client, indexName, version, language, sourceDirector mappings: { properties: { url: { type: 'keyword' }, - title: { type: 'text', analyzer: 'text_analyzer', norms: false }, + title: { + type: 'text', + analyzer: 'text_analyzer', + norms: false, + // This is used for fast highlighting. Uses more space but makes + // the searches faster. + term_vector: 'with_positions_offsets', + }, title_explicit: { type: 'text', analyzer: 'text_analyzer_explicit', norms: false }, - content: { type: 'text', analyzer: 'text_analyzer' }, + content: { + type: 'text', + analyzer: 'text_analyzer', + // This is used for fast highlighting. Uses more space but makes + // the searches faster. + term_vector: 'with_positions_offsets', + }, content_explicit: { type: 'text', analyzer: 'text_analyzer_explicit' }, headings: { type: 'text', analyzer: 'text_analyzer', norms: false }, headings_explicit: { type: 'text', analyzer: 'text_analyzer_explicit', norms: false },