You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/06/03 14:48:23 UTC

[GitHub] [cordova-plugin-file] coulson84 opened a new issue #393: copyTo command doesn't follow spec that is linked to from the README

coulson84 opened a new issue #393:
URL: https://github.com/apache/cordova-plugin-file/issues/393


   # Bug Report
   
   ## Problem
   On iOS, the copyTo command is throwing a path exists error when trying to call copyTo that overwrites an existing file
   
   ### What is expected to happen?
   According to the spec
   "A copy of a file on top of an existing file must attempt to delete and replace that file."
   
   
   ### What does actually happen?
   An error is thrown relating to the path existing so I assume that instead of trying to overwrite the file it is just bailing out
   
   
   ## Information
   https://www.w3.org/TR/2012/WD-file-system-api-20120417/#widl-Entry-copyTo-void-DirectoryEntry-parent-DOMString-newName-EntryCallback-successCallback-ErrorCallback-errorCallback
   
   
   
   ### Command or Code
   fileEntry.copyTo(targetDirectory, newName, successCallback, errorCallback); 
   
   
   
   ### Environment, Platform, Device
   iOS 13.x any iOS device
   
   
   
   ### Version information
   cordova-plugin-file 6.0.2
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x ] I searched for existing GitHub issues
   - [x ] I updated all Cordova tooling to most recent version
   - [ x] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-file] jmarshall-com commented on issue #393: copyTo command doesn't follow spec that is linked to from the README

Posted by GitBox <gi...@apache.org>.
jmarshall-com commented on issue #393:
URL: https://github.com/apache/cordova-plugin-file/issues/393#issuecomment-1030912184


   Exactly this is still happening for me, i.e. when running on iOS only, using `FileEntry.copyTo()` onto an existing file results in a `PATH_EXISTS_ERR`.  Looking into the source code at `plugins/cordova-plugin-file/src/iOS/CDVLocalFilesystem.m`, in the `copyFileToURL()` routine, lines 493-495 are:
   
   ```
   } else if (bNewExists) {
        // the full destination should NOT already exist if a copy
        errCode = PATH_EXISTS_ERR;
   ```
   
   As @coulson84 notes above, the (now deprecated) standard at W3C says that copyTo() should delete an existing destination file before copying.  Should this be followed in the source code above?  Or perhaps the plugin's `copyTo()` routine should have an `options` argument that allows this?
   
   It's not hard to work around-- on iOS, the app can just delete a destination file before copying-- but perhaps this could be fixed for the sake of consistency with other platforms, or at a minimum documented under "iOS Quirks".


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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