Skip to content

Link to source is invalid when using ssh remote git@github.com:owner/name.git #1295

Closed
@ggrossetie

Description

@ggrossetie
  • What version of documentation.js are you using? latest (12.1.2)
  • How are you running documentation.js (on the CLI, Node.js API, Grunt, other?): CLI

Please note that this bug is fixed in git-url-parse 11.1.2.

Reproduction case

$ npm init -y
$ npm i --save git-url-parse@10.1.0

test.js

const GitUrlParse = require("git-url-parse");
console.log(GitUrlParse("git@github.com:asciidoctor/asciidoctor.js.git"));
$ node test.js
{ protocols: [ 'http' ],
  protocol: 'ssh',
  port: null,
  resource: 'github.com',
  user: 'git',
  pathname: '/:asciidoctor/asciidoctor.js.git',
  hash: '',
  search: '',
  href: 'http://git@github.com/:asciidoctor/asciidoctor.js.git',
  query: [Object: null prototype] {},
  token: '',
  toString: [Function],
  source: 'github.com',
  git_suffix: true,
  name: 'asciidoctor.js',
  owner: ':asciidoctor',
  commit: undefined,
  ref: '',
  filepathtype: '',
  filepath: '',
  organization: ':asciidoctor',
  full_name: ':asciidoctor/asciidoctor.js' }

Notice that the organization and the owner is :asciidoctor (prefixed by :).

$ npm i --save git-url-parse@11.1.2
{ protocols: [],
  protocol: 'ssh',
  port: null,
  resource: 'github.com',
  user: 'git',
  pathname: '/asciidoctor/asciidoctor.js.git',
  hash: '',
  search: '',
  href: 'git@github.com:asciidoctor/asciidoctor.js.git',
  query: [Object: null prototype] {},
  token: '',
  toString: [Function],
  source: 'github.com',
  git_suffix: true,
  name: 'asciidoctor.js',
  owner: 'asciidoctor',
  commit: undefined,
  ref: '',
  filepathtype: '',
  filepath: '',
  organization: 'asciidoctor',
  full_name: 'asciidoctor/asciidoctor.js' }

Now the organization and the owner is valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions