isomorphic-git 1.40.6 → 1.40.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -8883,8 +8883,10 @@ async function _currentBranch({
8883
8883
  }
8884
8884
 
8885
8885
  function translateSSHtoHTTP(url) {
8886
- // handle "shorter scp-like syntax"
8887
- url = url.replace(/^git@([^:]+):/, 'https://$1/');
8886
+ // handle "shorter scp-like syntax". The user is dropped: it names an ssh
8887
+ // account and means nothing over https, which is what the old expression did
8888
+ // for `git@` too.
8889
+ url = url.replace(/^[^/@:]+@([^/@:]+):/, 'https://$1/');
8888
8890
  // handle proper SSH URLs
8889
8891
  url = url.replace(/^ssh:\/\//, 'https://');
8890
8892
  return url
@@ -9389,9 +9391,15 @@ class GitRemoteManager {
9389
9391
  * @param {string} args.url - The URL of the remote repository.
9390
9392
  * @returns {Object|undefined} - An object containing the transport and address, or undefined if parsing fails.
9391
9393
  */
9394
+ // git-clone(1) calls this the "shorter scp-like syntax": [user@]host:path. The
9395
+ // user is part of the syntax, not part of the word `git`, and a self-hosted
9396
+ // forge is as likely to hand out `gitolite@`, `forgejo@` or `ubuntu@`. The host
9397
+ // and the user cannot hold a slash, an at sign or a colon, so `https://x` and a
9398
+ // `scheme:address` override are left to the expression below.
9399
+ const scpLike = /^[^/@:]+@[^/@:]+:/;
9400
+
9392
9401
  function parseRemoteUrl({ url }) {
9393
- // the stupid "shorter scp-like syntax"
9394
- if (url.startsWith('git@')) {
9402
+ if (scpLike.test(url)) {
9395
9403
  return {
9396
9404
  transport: 'ssh',
9397
9405
  address: url,
@@ -9572,8 +9580,8 @@ function filterCapabilities(server, client) {
9572
9580
 
9573
9581
  const pkg = {
9574
9582
  name: 'isomorphic-git',
9575
- version: '1.40.6',
9576
- agent: 'git/isomorphic-git@1.40.6',
9583
+ version: '1.40.7',
9584
+ agent: 'git/isomorphic-git@1.40.7',
9577
9585
  };
9578
9586
 
9579
9587
  class FIFO {
package/index.js CHANGED
@@ -8870,8 +8870,10 @@ async function _currentBranch({
8870
8870
  }
8871
8871
 
8872
8872
  function translateSSHtoHTTP(url) {
8873
- // handle "shorter scp-like syntax"
8874
- url = url.replace(/^git@([^:]+):/, 'https://$1/');
8873
+ // handle "shorter scp-like syntax". The user is dropped: it names an ssh
8874
+ // account and means nothing over https, which is what the old expression did
8875
+ // for `git@` too.
8876
+ url = url.replace(/^[^/@:]+@([^/@:]+):/, 'https://$1/');
8875
8877
  // handle proper SSH URLs
8876
8878
  url = url.replace(/^ssh:\/\//, 'https://');
8877
8879
  return url
@@ -9376,9 +9378,15 @@ class GitRemoteManager {
9376
9378
  * @param {string} args.url - The URL of the remote repository.
9377
9379
  * @returns {Object|undefined} - An object containing the transport and address, or undefined if parsing fails.
9378
9380
  */
9381
+ // git-clone(1) calls this the "shorter scp-like syntax": [user@]host:path. The
9382
+ // user is part of the syntax, not part of the word `git`, and a self-hosted
9383
+ // forge is as likely to hand out `gitolite@`, `forgejo@` or `ubuntu@`. The host
9384
+ // and the user cannot hold a slash, an at sign or a colon, so `https://x` and a
9385
+ // `scheme:address` override are left to the expression below.
9386
+ const scpLike = /^[^/@:]+@[^/@:]+:/;
9387
+
9379
9388
  function parseRemoteUrl({ url }) {
9380
- // the stupid "shorter scp-like syntax"
9381
- if (url.startsWith('git@')) {
9389
+ if (scpLike.test(url)) {
9382
9390
  return {
9383
9391
  transport: 'ssh',
9384
9392
  address: url,
@@ -9559,8 +9567,8 @@ function filterCapabilities(server, client) {
9559
9567
 
9560
9568
  const pkg = {
9561
9569
  name: 'isomorphic-git',
9562
- version: '1.40.6',
9563
- agent: 'git/isomorphic-git@1.40.6',
9570
+ version: '1.40.7',
9571
+ agent: 'git/isomorphic-git@1.40.7',
9564
9572
  };
9565
9573
 
9566
9574
  class FIFO {