Skip to content

Commit

Permalink
fixup! refactor: fix update script to properly detect extension for f…
Browse files Browse the repository at this point in the history
…irefox

ds
  • Loading branch information
devversion committed Feb 12, 2022
1 parent b4dbbb6 commit 47b5bfd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bazel/browsers/update-script/browser-artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ export function detectArtifactExtension(filePath: string) {
// Iterate from the end of the path, finding the largest possible
// extension substring, accounting for cases like `a/b.tmp/file.tar.gz`.
while ((currentPart = path.extname(tmpPath)) !== '') {
// An extension needs to be a continuous set of alphanumeric characters. This is a strict
// requirement, but sufficient for our needs and helps making the determinationmore proof.
// An extension needs to be a continuous set of alphanumeric characters. This is a rather
// strict requirement as technically extensions could contain e.g. `dashes`. In our case
// this strictness is acceptable though as we don't expect such extensions and it makes
// this extension detection logic more correct. e.g. the logic would not incorrectly
// detect an extension for `firefox-97.0-linux.tar.gz` to `0-linux.tar.gz`.
if (!/^\.[a-zA-Z0-9]+$/.test(currentPart)) {
break;
}
Expand Down

0 comments on commit 47b5bfd

Please sign in to comment.