Added code and tests to handle apps with either no url or url that matches host url in app gallery