Skip to content

Commit

Permalink
chore(file): use const for path in getCandidates (#4281)
Browse files Browse the repository at this point in the history
* chore(file): use const for path in getCandidates

* chore: yarn version check --interactive
  • Loading branch information
trivikr committed Mar 29, 2022
1 parent 7f64a98 commit df41c95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .yarn/versions/f6c9fb9e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
releases:
"@yarnpkg/plugin-file": patch

declined:
- "@yarnpkg/cli"
7 changes: 3 additions & 4 deletions packages/plugin-file/sources/TarballFileResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ export class TarballFileResolver implements Resolver {
}

async getCandidates(descriptor: Descriptor, dependencies: unknown, opts: ResolveOptions) {
let path = descriptor.range;

if (path.startsWith(PROTOCOL))
path = path.slice(PROTOCOL.length);
const path = descriptor.range.startsWith(PROTOCOL)
? descriptor.range.slice(PROTOCOL.length)
: descriptor.range;

return [structUtils.makeLocator(descriptor, `${PROTOCOL}${npath.toPortablePath(path)}`)];
}
Expand Down

0 comments on commit df41c95

Please sign in to comment.