airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
199 stars 11 forks source link

Error #2147 Forbidden protocol in URL trying to print on iOS with Mobile Print Util #2988

Open rdefalco opened 8 months ago

rdefalco commented 8 months ago

Hello, we are trying to call an URL to invoke the app "Mobile Print Util" for iOS whose protocols are listed as examples here https://www.mobileprintutil.com/linktest.htm

with AIR 50, any current version, we try to call the method navigateToURL(new URLRequest(url));

where url is something like com.samathosoft.webprint://#deb64#[base64] and [base64] is replaced with an actual text encoded in Base64 format, but we get the error #2147 Forbidden protocol in URL

Opening the links from Safari actually opens the print app.

Searching online didn't lead me to useful resources, I've found there is a info.plist addition called "UISupportedExternalAccessoryProtocols" but I can't find a correlation with AIR.

EDIT: re-reading the documentation at https://help.adobe.com/en_US/air/reference/html/flash/net/URLRequest.html#url I've also tried to substitute the # symbol with %23 com.samathosoft.webprint://%23deb64%23[base64] but it did NOT work

EDIT2: I've also tried to include UISupportedExternalAccessoryProtocols but didn't have any effect apparently it's the dots in the protocol section of the URL that causes the issue, if I try the same url without the dots comsamathosoftwebprint://#deb64#[base64] obviously the target app does NOT open, but neither I get the forbidden protocol error.

ajwfrost commented 8 months ago

Yes it looks like there's code in there to check the scheme isn't something dodgy, but it's not then conforming to the spec... from RFC3986:

Scheme names consist of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus ("+"), period ("."), or hyphen ("-").

Whereas the code is going through to ensure the scheme is all alpha/numeric and only allowing a hyphen as a special character.

So this is something that needs an update in the runtime, albeit a very easy one...

thanks