Skip to content

Commit

Permalink
Revert "Fix #65. Check if the parsed resource is not null."
Browse files Browse the repository at this point in the history
This reverts commit f10ded0.
  • Loading branch information
pvdlg committed Jul 9, 2018
1 parent ff3919e commit c4dfff9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Expand Up @@ -49,8 +49,8 @@ function gitUrlParse(url) {
return gitUrlParse.stringify(this, type);
};

const parsedResource = parseDomain(urlInfo.resource);
urlInfo.source = parsedResource ? parsedResource.domain + '.' + parsedResource.tld : urlInfo.resource;
const parsedResource = parseDomain(urlInfo.resource)
urlInfo.source = parsedResource.domain + '.' + parsedResource.tld;

// Note: Some hosting services (e.g. Visual Studio Team Services) allow whitespace characters
// in the repository and owner names so we decode the URL pieces to get the correct result
Expand Down
7 changes: 1 addition & 6 deletions test/index.js
Expand Up @@ -281,13 +281,8 @@ tester.describe("parse urls", test => {
test.expect(res.toString()).toBe("http://user@github.com/owner/name.git");
});

test.it("custom url", () => {
test.should("custom url", () => {
var res = gitUrlParse("https://git.test.com.cn/a/b");
test.expect(res.source).toBe('test.com.cn');
})

test.it("local urls", () => {
var res = gitUrlParse("http://machine:8080/tfs/Collection/Project.Name/_git/repository");
test.expect(res.source).toBe('machine');
})
});

0 comments on commit c4dfff9

Please sign in to comment.