I am trying to download a image stored in the Firebase Storage, using Unity. I use Unity Firebase SKD (in Beta...). This is my code:
...
// Points to "1/preview.jpg"
Firebase.Storage.StorageReference img_ref = folder1_ref.Child("/preview.jpg");
// Fetch the download URL
img_ref.GetDownloadUrlAsync().ContinueWith(task => {
Debug.Log(task.Result.ToString());
});
The console output is:
https://firebasestorage.googleapis.com/v0/b/insidehome-29c9e.appspot.com/o/1/preview.jpg?alt=media&token=092a8de8-5047-4bce-b179-edd4101847a3
If I try to download the file using www or a browser, with this URL, I obtain an error. The good URL should be (copied by Firebase console):
https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Finsidehome-29c9e.appspot.com%2Fo%2F1%2Fpreview.jpg%3Falt%3Dmedia%26token%3D092a8de8-5047-4bce-b179-edd4101847a3
The difference is only in a single slash ("/") before the word "preview".
Is this strange? How could I fix it? I try Escape the URL but it change all the slash:
https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Finsidehome-29c9e.appspot.com%2Fo%2F1%2F99%2Fobama.jpg%3Falt%3Dmedia%26token%3D8a33f998-e271-4d7e-8848-356a332b7750
And It does't work. I need to change only the parameters (right) slash
Hi Firebase engineer here. This is a bug and I'm sorry you encountered this. There should be no slash after "/o/". The 2 slashes surrounding the letter "o" are valid, but every forward slash after that should be displayed as %2F.
This is not a general escaping issue as you should not re-escape the entire URL. This is a side effect of a related mono issue in unity where the Uri class incorrectly decodes %2F into a slash when it shouldn't.
You can work around this by simply replacing slashes after "/o/" with %2F. However, you should know about a corresponding issue with UnityWebRequest:
https://issuetracker.unity3d.com/issues/unitywebrequest-dot-url-unescapes-escaped-symbol
where Unity's libraries are also being affected by this bug (so it may break even if you fix the string and pass it back to unity). It looks like that issue was fixed in 5.5.1 (and I've verified it in 5.6 beta).
On the firebase side, we will change our code to account for this issue in mono so it returns the correct url. Until we get this fix out, I suggest using the workaround of replacing slashes or simply use Firebase itself to download the file.
You can use Unity's WWW.EscapeURL to escape url.
string escapedUrl = WWW.EscapeURL("http://www.someurl");
Related
On my iPhone, when I paste "zerø.info" into a browser (chrome/firefox) and search, then I see the URL turn to "zer%c3%b8.info" and then it's turned into "xn--zer-2na.info".
In my project (iPhone app), when I call urlStr.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) I get "zer%c3%b8.info".
How can I get the final URL "xn--zer-2na.info" in Swift 5?
This is called "IDNA encoding", which is basically the Punycode of the domain name prefixed with "xn--". There is no built-in way of generating this in Swift, according to this forum post.
There is a CocoaPod called PunycodeSwift that generates these. For example,
"zerø.info".idnaEncoded // xn--zer-2na.info
Note that this returns an optional, since this conversion can fail if e.g. the result is longer than the allowed 63 characters of a host name.
Also note that not all browsers support this.
Please help to solve Error: unsupported URL (IOS).When i adding data to url from reducer it not working but normally when adding url to fetch data without reducer data it error.(Same code works in Android )
There may be some value in your query string with special characters (like spaces). Try encoding the api url using encodeURI() in javascript. Or, if you are passing another url in your api query params then you may have to encode symbols which are reserved for urls (for eg: ?, :, / etc.) use encodeURIComponent() for this case. This resolved the same issue for me.
I solved with remove spaces i dont know where is space but when i get link from reducer and then replace space to empty and all solved
I tried following the answers gave here, but I get the error Imported Xml content can not be parsed.
Here's what I tried:
=importXml("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ/","//span[#id='priceblock_ourprice']")
=importxml(hyperlink(concatenate("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ/")),"//*[#id='priceblock_ourprice']")
None of them worked..
EDIT: The functions are intermittently working. Seems there's an issue specifically with the Amazon site as sometimes this works, sometimes it doesn't (and I get "imported content cannot be parsed"). When it doesn't, sometimes if I add or remove the trailing slash it works again. No problem with other sites. Seems a known issue: https://productforums.google.com/forum/#!topic/docs/UuMGRl7Asew https://productforums.google.com/forum/#!topic/docs/yWPaNDK0Kpg
What's a mistery is the cause.
if you try //* xPath, then you'll see that Amazon is making a robot check. That is the reason of unsuccessful parsing.
Unfortunately, I can't see the obvious way to overcome this.
And, as to changing comma to semicolon and vice versa - it doesn't work, because it depends on your local settings for Google Spreadheet, which delimiter you have to use in functions. For some countries it's a comma, for others it's a semicolon.
Try this:
=importXml("http://www.amazon.it/Asus-GeForce-Scheda-Display-Edition/dp/B00SKWIISQ";"//span[#id='priceblock_ourprice']")
I changed the colon to semicolon and removed the trailing slash of the URL to make sure that no HTTP redirects are done.
May be a dumb question, but it's been bugging me recently. I see "URL=" inside alot of URL's, such as this one:
http://www.tierraantigua.com/search-2?url=http%3A%2F%2Flink.flexmls.com%2Fwws30ham
What exactly is this used to do? Is it part of the iFrame functionality? I know the last part of the URL (after the URL=) is the part being displayed in the iFrame, but I'm unsure of why it is included in the primary URL as well.
Thanks!
The url you see here is just a standard query parameter wit the name url and the encoded value http%3A%2F%2Flink.flexmls.com%2Fwws30ham which decodes to http://link.flexmls.com/Fwws30ham. Most of the times it is used for determining redirection or source information by the application you are using. It is entirely domain-specific and can have any meaning the website developer would like to use.
PHP GET
Description ¶
An associative array of variables passed to the current script via the URL parameters.
$url = $_GET['url'];
echo $url; // http%3A%2F%2Flink.flexmls.com%2Fwws30ham
If I add slash / to the parameter of a page, even in encoded form %2F I get an error.
Sample URL:
http://mywebsite.com/somepage?param=dfgdfg%2F
Error:
Input string 'dfgdfg/' is not valid; the character '/' at position 7 is not valid.
I am trying to pass whole URL as parameter (to later redirect user to that URL) so there are a lot of slashes in there.
Is this a bug? Is there any workaround?
I could theoretically replace all slashes with something else than %2F but that is something I would attempt after everything else fails...
As I've learned this happens on Jetty only, which I use for development...
This custom service override solved the problem:
http://tapestry.1045711.n5.nabble.com/Customising-T5-URL-Encoding-tp2412550p2412551.html
Looks very hacky but works :).
See the Web Services More example on the JumpStart page. Works for me on Jetty.
The JumpStart page has many "how-to-do-this-in-Tapestry" examples.