Ok, what do you think of replacing all your code by:

```javascript
var adjustment = (linkSpec.match[2][0] === '.') ? 1 : 0;
var start = linkSpec.match[1] ? linkSpec.match[1].length : 0;
var href = (linkSpec.match[1] || 'http://') + href.slice(start + adjustment);
```

Would that work ?