From 43e8748917171783afd1abdd4760341da2569348 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 28 Feb 2017 21:55:11 +0100 Subject: [PATCH] fix(docs): only rewrite relative links * Right now the script actually seemed to work on Windows because the delimiters were different and the `indexOf` check passed therefore. * It didn't work on non-windows platforms (but the `indexOf` worked), because the logic was incorrect. Previously only links that are not inside of `guides/` have been rewritten. Fixes #3147 --- tools/gulp/tasks/docs.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/gulp/tasks/docs.ts b/tools/gulp/tasks/docs.ts index 14fcdbbeb13e..551ebcff984f 100644 --- a/tools/gulp/tasks/docs.ts +++ b/tools/gulp/tasks/docs.ts @@ -82,7 +82,9 @@ function transformMarkdownFiles(buffer: Buffer, file: any): string { /** Fixes paths in the markdown files to work in the material-docs-io. */ function fixMarkdownDocLinks(link: string, filePath: string): string { - if (link.startsWith('http') && filePath.indexOf('guides/') === -1) { + // As for now, only markdown links that are relative and inside of the guides/ directory + // will be rewritten. + if (!filePath.includes(path.normalize('guides/')) || link.startsWith('http')) { return link; }