From 77886a3520ec133aa788b5013b2bb69a0c752a84 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Fri, 20 Jan 2023 16:24:32 -0500 Subject: [PATCH] Make repoPathRegex more permissive. It will now accept "revisions" which are git tag names. For example: git:github.com/torvalds/linux:arch/x86/mm/fault.c:v5.15 In this example, the tag name / "revision" is "v5.15". The CORS-URL for this file would then be https://raw.githubusercontent.com/torvalds/linux/v5.15/arch/x86/mm/fault.c --- src/test/unit/special-paths.test.js | 10 ++++++++++ src/utils/special-paths.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/unit/special-paths.test.js b/src/test/unit/special-paths.test.js index ed1b3c944d..bb6db2bc02 100644 --- a/src/test/unit/special-paths.test.js +++ b/src/test/unit/special-paths.test.js @@ -54,6 +54,16 @@ describe('parseFileNameFromSymbolication', function () { path: 'core/fdrm/fx_crypt.cpp', rev: 'dab1161c861cc239e48a17e1a5d729aa12785a53', }); + expect( + parseFileNameFromSymbolication( + 'git:github.com/torvalds/linux:arch/x86/mm/fault.c:v5.15' + ) + ).toEqual({ + type: 'git', + repo: 'github.com/torvalds/linux', + path: 'arch/x86/mm/fault.c', + rev: 'v5.15', + }); }); it('parses s3 paths', function () { diff --git a/src/utils/special-paths.js b/src/utils/special-paths.js index eb6091f211..13f35eb0b6 100644 --- a/src/utils/special-paths.js +++ b/src/utils/special-paths.js @@ -81,7 +81,7 @@ export type SourceFileDownloadRecipe = // Some rust stdlib functions: (https://bugzilla.mozilla.org/show_bug.cgi?id=1717973) // "/builds/worker/fetches/rustc/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs" const repoPathRegex = - /^(?hg|git):(?[^:]*):(?[^:]*):(?[0-9a-f]*)$/; + /^(?hg|git):(?[^:]*):(?[^:]*):(?.*)$/; const s3PathRegex = /^s3:(?[^:]*):(?[0-9a-f]*)\/(?[^:]*):$/; const cargoPathRegex =