apache / apache/cordova-plugin-file
copyTo command doesn't follow spec that is linked to from the README
- Dominant language
- JavaScript
- Stars
- 744
- Forks
- 754
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 1
Description
# 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
- [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
Contributor guide
Research direction
Start with the README's linked File System API specification and trace the iOS implementation of fileEntry.copyTo(targetDirectory, newName, successCallback, errorCallback). Reproduce the case on iOS 13.x with an existing destination file; done means copyTo replaces that file instead of returning a path-exists error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100