Utils: Fixed dirname for paths with protocol