apache / apache/cordova-plugin-file-transfer
Getting code 1 file exists on file download
- Dominant language
- JavaScript
- Stars
- 606
- Forks
- 874
- PR merge metrics
- No merged PRs in 30d
Description
Plugin version 2.0.0-7
On Android, downloading files - everything was working and then I changed a bunch of variable and function calls to clean up the code and now its not working. Obviously I changed something but at the moment can't figure out what. A print out of the error code gives me this:
```
body: null
code: 1
exception: "/storage/emulated/0/Download/MyApp/BYG/REIA_Check_List.doc: open failed: EEXIST (File exists)"
http_status: 200
source: "https://portal.mydomain.com/files/C1002/docs/reia-doc_8125235.doc?cb=1693485905486"
target: "file:///storage/emulated/0/Download/MyApp/BYG/REIA_Check_List.doc"
```
Its the correct source that I can download with the same direct url in a browser. The target is the correct location and file name...and this is the same place it was writing to prior to code changes and breaking. The error implies the file already exists but checking in the folder it does not exist, the path `MyApp/BYG/` does exist
What does this error mean: `Code 1, open failed: EEXIST (File exists)` ??
From reading other issues, `Code 1` just seems to be a general error code and not specific to the actual problem. I also saw code 1 with a `permission denied` messages, so Code 1 just seems to mean a general failure
Contributor guide
Research direction
Start by reproducing the Android download with the reported source URL and target path, both when the target file is absent and when it already exists. Inspect the plugin's download error handling to determine why Android reports EEXIST, then document the cause and the conditions needed to complete the download successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100