Fix issue where url component could be invalid

If the url component (the end of the url) is not valid but the domain
is, throw an error because the room id is invalid.