| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a2843f8 commit 7643bc8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,12 +64,18 @@ function transformProjectRoot(replacement = '<project-root>') { | |||
| 64 | 64 | const winPath = replaceWindowsPaths(projectRoot); | |
| 65 | 65 | // Handles URL encoded project root in file URL strings as well. | |
| 66 | 66 | const urlEncoded = pathToFileURL(projectRoot).pathname; | |
| 67 | + // On Windows, paths are case-insensitive, so we need to use case-insensitive | ||
| 68 | + // regex replacement to handle cases where the drive letter case differs. | ||
| 69 | + const flags = common.isWindows ? 'gi' : 'g'; | ||
| 70 | + const urlEncodedRegex = new RegExp(RegExp.escape(urlEncoded), flags); | ||
| 71 | + const projectRootRegex = new RegExp(RegExp.escape(projectRoot), flags); | ||
| 72 | + const winPathRegex = new RegExp(RegExp.escape(winPath), flags); | ||
| 67 | 73 | return (str) => { | |
| 68 | 74 | return str.replaceAll('\\\'', "'") | |
| 69 | 75 | // Replace fileUrl first as `winPath` could be a substring of the fileUrl. | |
| 70 | - .replaceAll(urlEncoded, replacement) | ||
| 71 | - .replaceAll(projectRoot, replacement) | ||
| 72 | - .replaceAll(winPath, replacement); | ||
| 76 | + .replaceAll(urlEncodedRegex, replacement) | ||
| 77 | + .replaceAll(projectRootRegex, replacement) | ||
| 78 | + .replaceAll(winPathRegex, replacement); | ||
| 73 | 79 | }; | |
| 74 | 80 | } | |
| 75 | 81 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments