http://localhost/#/showinfo/http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fobject%2F1%2Fcollection%2F1
I'm trying to pass a URL thats encoded with encodeURIComponent to another page. but it seems that the URL is invalid.
Related
I have a base url that i want to redirect the user to, but this url have another url in its query param
for ex:
base_url = "https://www.base.com?origin=#{origin_url}"
the origin url itself have some query params
origin_url = 'https://www.origin.com?utm_source=foo&utm_term=bar'
but there is a problem with that, if I just use this url it comes like this
https://www.base.com?origin=https://www.origin.com?utm_source=foo&utm_term=bar
with that url, the &utm_term becomes a query string for the base url, and not for the origin url
is there a special type of encoding to deal with this nested query string problem ?
I've tired use URI.encode_www_form_component in the origin_url, and I got
https%3A%2F%2Fwww.origin.com%3Futm_source%3Dfoo%26utm_term%3Dbar
so the Full url became
https://www.base.com?origin=https%3A%2F%2Fwww.origin.com%3Futm_source%3Dfoo%26utm_term%3Dbar
but the problem is that I always decode the url before redirect, so it just get decoded again.
If the url get from UIPasteboard.general.URL is always valid URL? My requirement is if the string in UIPasteboard is a valid url, I will show "Paste and Go", if not, I will show "Paste and Search".
UIPasteboard URL is of type URL?. This means if it is a non-nil value then it must be a valid URL. You can't create a URL from an invalid URL.
But "valid" here means it has the proper syntax for a URL. It has a valid scheme such a https or file or mailto, etc. And the scheme has other parts that seem to be correct.
But a "valid" URL doesn't mean it is going to give you good results. For example, http://ThisIsNotARealDomain.com/fake/fake.html is a "valid" URL but putting that in a browser won't give you anything useful.
Is UIPasteboard.general.URL is non-nil, attempt to load the URL and check the result. If it fails, you could opt to then attempt a search.
here is the solution for php Passing base64 encoded strings in URL
but because of urlencode cakephp problem I cant use it (the solution in there is not good for me)
Passing an urlencoded URL as parameter to a controller / action at CakePHP
Rawurlencode does not work either. Also I cant hash it because I need it to be reversible. Or is there some "reversible" hash function. I know that the meaning of hash is for one way, but like some way to get output similar(so I can use in the url without problems) to md5/sha* but be able to reverse.
QSN: how to use base64 encoded string in url to avoid problems, mentioned in the above link.
How do i pass a URL-encoded URL to CURL?
Ex:
curl "http://live.nwk5.net/secure/v.stream/playlist.m3u8?expiry=kFmysuf%2fLjOqgdXGJWqFQA%3d%3d"
This returns a invalid page.
if I URL decode the parameter as below, Im getting the expected response. Please Help.
curl "http://live.nwk5.net/secure/v.stream/playlist.m3u8?expiry=kFmysuf/LjOqgdXGJWqFQA=="
You're talking in vague terms. curl accepts and expects a URL. You need to provide the correct URL as curl can't guess what you otherwise intended.
If you have the URL encoded into weirdness, you have to first decode it to tell curl the correct URL.
URL-encoding a URL an extra time like you seem to have done partly (because otherwise you would also have encoded the slashes etc), is what I consider "encoded into weirdness".
In MVC, I'm attempting to use URL routing to get the result of an action given a certain input.
Consider the following in my view:
<%=Html.ActionLink("View", "Test", new with {.id = Url.Encode(dir\file}) %>
My controller then uses HttpUtility.UrlDecode(id) to get the original. The controller itself is using File() to retrieve a file at the specified directory\file location. However, an error message pops up telling me that
A potentially dangerous Request.Path value was detected from the client (%).
The URL is showing up as
http://home/dir%255cfile.txt
I googled Url Encoding and \ is encoded as %5c. Where is the %25 coming from? It's the encoding for %, but that means Encode is being done twice. Why is that, and is that supposed to be happening?
Html.ActionLink takes care of the URL encoding for you. If you don't encode the params there, there's no need to decode it again and your issue is solved.