NativeScript / NativeScript/plugins
composing email with attachments fails on Android (fix provided)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 206
- Forks
- 123
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 1
Description
@nativescript/Email v2.0.5
Error
Calling email.compose with array 'attachments' fails with this error:
JS: 'Error in email.compose: TypeError: Cannot read property 'indexOf' of undefined'
Problem
The problem is that 'compose' in "index.android.js" parses attachments using a "for-in" loop. My array created via brackets in JS has a 'move' method by default, and so this for-in loop parses 'attachments[move]' which fails.
Fix
The fix is simply to change it to a "for-of" loop, as is the case in "index.ios.js".
Replace this...
for (const a in arg.attachments) {
const attachment = arg.attachments[a];
with this...
for (const attachment of arg.attachments) {
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open index.android.js and compare its attachment handling with the for-of loop in index.ios.js. Verify the requested iteration change and test composing an email with an array of attachments on Android; done means the attachments no longer trigger the reported indexOf error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100