Automattic / Automattic/jetpack

Extra Sidebar Widgets: Upcoming Events renders new lines as "n" characters

Open
#2,490 4 comments 0 reactions 0 assignees View on GitHub
[Feature] Extra Sidebar Widgets [Pri] Normal [Status] Stale Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

In the Upcoming Events widget, new lines are shown as "n" instead of becoming br tags.

I'm using Google Calendar's ICS links in my widget and I have hit this particular scenario.

If your calendar app created an event with a location like this:

School
Happy Avenue 201
Lima

It will be exported in an ICS as:

```
LOCATION:School\nHappy Avenue 201\nLima
```

It will be shown in the sidebar widget as:
SchoolnHappy Avenue 201nLima

It seems this is because the code uses stripslashes() instead of stripcslashes():
https://github.com/Automattic/jetpack/blob/master/_inc/lib/icalendar-reader.php#L730

I believe the solution would be to change that, and then convert the new lines to br tags, or blank spaces.

Contributor guide

Open the contributing guide

Research direction

Start at _inc/lib/icalendar-reader.php around line 730 and trace how the escaped LOCATION value reaches the Upcoming Events widget. Reproduce the supplied ICS location and verify that its line breaks render as breaks or spaces rather than literal "n" characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.