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

resolveLocalFileSystemURI returns SECURITY_ERROR wrongly in iOS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0
    • None
    • None
    • iOS

    Description

      The simplified version of resolveLocalFileSystemURI in the 3.0.0 file plugin doesn't properly check the URI if it's in the tmp or Documents folder and returns FileError.SECURITY_ERROR instead. This doesn't occur in 2.9.0.

      For example, trying to resolve a URI of a video file from using getPicture().

      Calling the following lines in CDVFile.m using the above example:

      NSLog(@"url path: %@", path);
      NSLog(@"docs path: %@", self.appDocsPath);
      NSLog(@"temp path: %@", self.appTempPath);
      

      returns these:
      url path: /private/var/mobile/Applications/[app id]/tmp//trim.TpPlJN.MOV
      docs path: /var/mobile/Applications/[app id]/Documents
      temp path: /var/mobile/Applications/[app id]/tmp

      Since the security error check uses hasPrefix against self.appDocsPath and self.appTempPath here, it fails the check.

      Attachments

        Activity

          People

            iclelland Ian Clelland
            yiming.kuan Kuan Yi Ming
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: