avoid pathname being null

require('url').parse('ssh://xxx') -> { pathname: null }, then obj.pathname.replace will get error