jasonleibowitz / react-add-to-calendar-hoc

Simple Unopinionated React Add to Calendar Button. Bring your own components.
http://leibowitz.me/react-add-to-calendar-hoc/docs/
MIT License
70 stars 40 forks source link

Newlines for DESCRIPTION in ics files are unescaped #33

Closed wyantb closed 4 years ago

wyantb commented 4 years ago

Bug report

Describe the bug

Newlines in ics files need to be escaped to be visible when viewed in MS outlook and similar ics file viewers ( https://stackoverflow.com/a/18328506 ). Right now, the HOC doesn't do anything special to escape <br>s or \ns in input fields, which works great for google calendar invites, but won't show up in ics files. I'm guessing that a simple regex as part of https://github.com/jasonleibowitz/react-add-to-calendar-hoc/blob/master/lib/utils.js#L121 would do the trick in producing an ics file with newlines that ics file clients would accept and display properly.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Make an event with newlines in the description field
  2. Share in as OUTLOOK
  3. Open it up it MS outlook

Expected behavior

Newlines to appear in the description

Actual behavior

No newlines appear in the description

System information

Additional context

If my instinct about where the fix is needed here is correct, happy to put up a PR with a fix. Let me know. Thanks for your work!

jasonleibowitz commented 4 years ago

Hey @wyantb Feel free to put up a PR. However, I'll probably have time to take a look over the holiday, i.e. before Monday.

wyantb commented 4 years ago

OK great! I've prototyped a fix locally and it now loads up fine in the macOS calendar app, just getting our QA guy to load it up in Outlook real quick before I send you a PR. Should be ready tomorrow no problem.

jasonleibowitz commented 4 years ago

Apologies for the delay. This has been resolved by #37 and released in version 1.0.10, which is now available on NPM.