Docker-manager plugin not linking to github properly

Think I’ve tracked it down. It breaks for repositories that have been cloned without the URL ending in .git

(I cloned by doing git clone https://github.com/discourse/discourse-push-notifications instead of https://github.com/discourse/discourse-push-notifications.git)

I believe the line causing this is line 9 here:
https://github.com/discourse/docker_manager/blob/master/manager-client/app/helpers/fmt-commit.js#L9

If the URL doesn’t contain .git then url.indexOf returns -1, and so url.substr(0,-1) returns an empty string.

Something like this might work (but there’s probably a tidier way):

var extension = url.indexOf('.git')
if (extension == -1){
    var _url = url  	
}else{
    var _url = url.substr(0, extension);	
}

Unfortunately I can’t manage to build docker-manager/manager-client in my dev environment so I can’t test this or do a pull request :frowning:

3 лайка