Fix a long-standing bug where room directory requests would cause an internal server error if given a malformed room alias.