cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-9485) processOpenURL shortens long URLs with ellipsis
Date Fri, 04 Sep 2015 05:08:45 GMT

    [ https://issues.apache.org/jira/browse/CB-9485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14730332#comment-14730332
] 

ASF subversion and git services commented on CB-9485:
-----------------------------------------------------

Commit 99f5a3361080786da8653bdda5fbf1b98c1fede3 in cordova-ios's branch refs/heads/master
from [~purplecabbage]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git;h=99f5a33 ]

CB-9485 Use absoluteString method of NSURL


> processOpenURL shortens long URLs with ellipsis
> -----------------------------------------------
>
>                 Key: CB-9485
>                 URL: https://issues.apache.org/jira/browse/CB-9485
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 3.7.0
>         Environment: iOS
>            Reporter: Tom Br├╝ckner
>            Assignee: Jesse MacFadyen
>              Labels: cordova-ios-4.0.x, processOpenURL
>
> I'm building a hybrid app and wanted to use the openProcessURL() mechanism to transfer
data from the native side to the webapp. The data consists of a rather large string.
> Here I noticed, that this URL will get shortened using an ellipsis (...) and thus not
transfered correctly to the webapp.
> I tracked the problem down to its root cause. The problem is that NSURL automatically
shortens URLs if you are just converting it into a string. This "feature" is also described
here:
> http://stackoverflow.com/questions/30764851/nsurl-urlwithstring-is-shortening-very-long-strings-with-an-ellipsis-crea
> Cordova iOS uses this kind of direct string conversion before the URL is handed over
to the native side. In Cordova 3.7.0 (which I'm using), this happens in CDVViewController.m
(processOpenURL). In the latest Cordova development branch, the same happens in CDVHandleOpenURL.m
(handleOpenURL).
> In both cases, the errorneous conversion / shortening is a side-effect of the call to
[NSString stringWithFormat], where the NSURL is handed over as a string. This causes ellipsis
generation.
> As described in the stack overflow question linked above, the problem does not occur
if the parts of the URL (e.g. the path or the query) are converted seperately, and I can confirm
that.
> To fix the problem, you can replace
> NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function')
{ handleOpenURL(\"%@\");}", url];
> with
> NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function')
{ handleOpenURL(\"%@\");}", url.absoluteString];
> The .absoluteString retrieves the unaltered URL, this patch worked for me.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message