Skip to content

Commit

Permalink
fix(resolution): Handle git urls that have a hash in the branch name.
Browse files Browse the repository at this point in the history
Previously yarn was using a string split('#') to separate the URL from the branch name. If a branch
also had a hash in it, then the rest of the split chunks were ignored, meaning only the chunk before
the first '#' was used as the branch name. This change handles those URLs correctly, preserving the
'#'s in URL hashes.

yarnpkg#5954
  • Loading branch information
rally25rs committed Jun 9, 2018
1 parent 2c98a00 commit 04f2cc1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util/version.js
@@ -1,10 +1,10 @@
/* @flow */

export function explodeHashedUrl(url: string): {url: string, hash: string} {
const parts = url.split('#');
const [server, ...hashes] = url.split('#');

return {
hash: parts[1] || '',
url: parts[0],
hash: hashes.length ? hashes.join('#') : '',
url: server,
};
}

0 comments on commit 04f2cc1

Please sign in to comment.