Fix bug of parsing URLs containing spaces