You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jesse MacFadyen (JIRA)" <ji...@apache.org> on 2013/08/23 00:31:52 UTC
[jira] [Resolved] (CB-4421) WP8 Project - XHRHelper.HandleCommand
failing with 'System.InvalidOperationException: This operation is not
supported for a relative URI" error
[ https://issues.apache.org/jira/browse/CB-4421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jesse MacFadyen resolved CB-4421.
---------------------------------
Resolution: Fixed
Tests here:
https://git-wip-us.apache.org/repos/asf?p=cordova-mobile-spec.git;a=commit;h=4b129f7e0e38d107de7107b528bf2a42f6657793
> WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException: This operation is not supported for a relative URI" error
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CB-4421
> URL: https://issues.apache.org/jira/browse/CB-4421
> Project: Apache Cordova
> Issue Type: Bug
> Components: WP8
> Affects Versions: 3.0.0
> Environment: Development Environment: Visual Studio 2012 (with Update 3), Windows 8 x64,
> Target Environment: Windows Phone 8.0
> Other libraries - jquery, requirejs
> Reporter: Shashank Banerjea
> Assignee: Jesse MacFadyen
> Labels: 3.0.0, InvalidOperationException, WL, cordova, jquery, phonegap, requirejs, wp8, xhrhelper
>
> In the WP8 application we are developing, when the following code is being executed -
> {panel}
> $.get("/www/folder/to/devConfig.txt").done( function(content) {
> settings = JSON.parse(content)
> } );
> {panel}
> I get the following exception:
> {System.InvalidOperationException: This operation is not supported for a relative URI.
> at System.Uri.get_AbsolutePath()
> at WPCordovaClassLib.CordovaLib.XHRHelper.HandleCommand(String commandStr)
> at WPCordovaClassLib.CordovaView.CordovaBrowser_Sc...
> I tried various combination such as:
> - "file:///www/folder/to/devConfig.txt" and "file://localhost/folder/to/devConfig.txt", which translated to "/www/folder/to/devConfig.txt", in the relative path.
> In these cases I received a 404 error.
> Reading through the documentation, it seems that the first "/" needs to be removed for the relative path to work, instead of "/www/folder/to/devConfig.txt" should be "www/folder/to/devconfig.txt".
> Sending "www/folder/to/devconfig.txt", causes the first exception.
> As a fix, I have modified the XHRHelper code to check for isAbsoluteUri condition and remove the first "/" if it is a relative path. That seems to work. But it is not a future proof solution.
> Please advise.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira