Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-2183

[iOS] FileTransfer.didReceiveResponse may not return NSHTTPURLResponse

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.0
    • 2.4.0
    • cordova-ios
    • Tested on iOS 5.1 and 6.0

    Description

      When FileTransfer.download() is downloading a file from file:///, NSURLConnection did not return with NSHTTPURLResponse. This will fail for apps that copy files from www/, e.g. apps that initialize its database from a pre-built cache packaged in IPA.

      In CB-1600 (fixed in 2.2.0), the fix assumes all response must be NSHTTPURLResponse. So when FileTransfer.download() is downloading from a file:/// URL (e.g. copying file from www/ folder to Documents/), FileTransfer assumed the download operation failed and returned 403.

      Tested if we comment out CB-1600, downloading from file:/// works again.

      We need to find out a better fix instead of commenting out CB-1600.

      According to http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html#//apple_ref/doc/uid/10000165i, URL of file:/// is supported.

      You can test FileTransfer.download() by calling it with "encodeURI(document.location.href)" as the "source" parameter.

      Attachments

        Issue Links

          Activity

            People

              agrieve Andrew Grieve
              compulim William Wong
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: