Raise URI::InvalidURIError if wrong uri.

Until we implement our own parser, raise URI::InvalidURIError  when gid is incorrect
The path regexp does not permit blank URI components, so this method is unnecessary.