NativeScript / NativeScript/plugins

composing email with attachments fails on Android (fix provided)

Open
#199 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.