%2F makes prepending happen on unitywebrequest

I don’t know what to do anymore. I am simply trying to make a get request, but localhost keeps being prepended to the request. I tried starting the url with “//” instead of “https://” as described here, but it doesn’t work.

@brendanduncan_u3d

I figured out the issue. The “%2F” on the url makes the prepending happen.

https://firebasestorage.googleapis.com/v0/b/myapp.appspot.com/o/clienteX%2FDuck.glb?alt=media&token=6dbe36da-360f-4d0c-8ff6-a27c94813316

If I use the url above and use the method

UnityWebRequest www = UnityWebRequest.Get(url);

and then check the www.url (the url that is actually used for the request), it is prepended with localhost, and I can’t remove it.

If I try UnityWebRequest www = UnityWebRequest.Get(new Uri(url)); I actually get an error:

UriFormatException: Invalid URI: The URI scheme is not valid.

Curiously, I do not get the error when running on play mode, and the url is also not prepended with localhost on playmode. This problem only happens on the actual build.

If I remove the %2F and make the url

https://firebasestorage.googleapis.com/v0/b/myapp.appspot.com/o/clienteXDuck.glb?alt=media&token=6dbe36da-360f-4d0c-8ff6-a27c94813316

and check the www.url, the url is no longer prepended with localhost.

This seems like a UnityWebRequest bug. Am I missing something?

Also, I followed this SO post to check if the uri is valid, even with %2F, and it is valid. It’s just unitywebrequest that says it’s not.

How can I get around this?

And look, this was reported before https://answers.unity.com/questions/1644199/how-to-prevent-unescaping-the-redirected-url.html

This forum thread can be deleted. The issue was that a third party library was returning a url enclosed in quotes, which I was using to build the uri. I realized the problem when I manually tried building the uri with the hard coded string in the start method and no problem happened, but getting the url from the third party plugin was raising the error.