Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(android): remove incorrect trailing newline in readFile when using encoding #1626

Merged

Conversation

27pchrisl
Copy link
Contributor

Using this test:

(async() => {
  let test = async (content, encoding) => {
    await Capacitor.Plugins.Filesystem.writeFile({ path: "fa", data: content, directory: "DOCUMENTS", encoding })
    return content === ((await Capacitor.Plugins.Filesystem.readFile({ path: "fa", directory: "DOCUMENTS", encoding })).data);
  }

  console.log(await test("\ra b\r\nc d\n\r\n", "utf8") ? 'ok' : 'ko');
})();

iOS and PWA implementations returned 'ok', Android returned 'ko'. This PR causes Android to return 'ok'.

Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor change

Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks!

@jcesarmobile jcesarmobile changed the title Fix Android inserting a trailing newline in readFile when using encoding Fix(android): inserting a trailing newline in readFile when using encoding Jun 12, 2019
@jcesarmobile jcesarmobile changed the title Fix(android): inserting a trailing newline in readFile when using encoding Fix(android): remove incorrect trailing newline in readFile when using encoding Jun 12, 2019
@jcesarmobile jcesarmobile merged commit 2e2bc4d into ionic-team:master Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants