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-4421) WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException: This operation is not supported for a relative URI" error
Date Fri, 13 Sep 2013 01:20:53 GMT

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

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

Commit 84c1395b490d1a9212b9ca96fe35dae91c0c1ae6 in branch refs/heads/master from [~purplecabbage]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-wp8.git;h=84c1395 ]

CB-4421 Fix for XHR to local files, can now be relative to current page, as expected

                
> 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

Mime
View raw message