Skip to content

Conversation

patrykgruszka
Copy link
Member

@patrykgruszka patrykgruszka commented Jul 30, 2021

Q A
Branch? "features"
Bug fix? yes
New feature? no
Deprecations? no
BC breaks? no
Automated tests included? yes
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #...

Description:

Special characters in email name (e.g. '"<>&) are not escaped when entity is stored in database. In other hand the AJAX email lookup ajax?action=email:getLookupChoiceList escapes the query when performing a search. In effect when an email name contains special characters it can't be found.

This will also affect actions, and fixes similar issues with company, dynamicContent, message, sms, mauticSocial.

Steps to reproduce:

  1. Create an email with name containing special characters e.g It's an email
  2. Create campaign and add email send action
  3. Try to search email typing the name with special character. While you type there will be a message "No matches found it's". The email appears on the list only because it was preloaded. If there were more emails in the system it would not show the result at all.
    image

Steps to test this PR:

  1. Load up this PR
  2. Repeat steps to reproduce
    obraz

@cla-bot cla-bot bot added the cla-signed The PR contributors have signed the contributors agreement label Jul 30, 2021
@codecov
Copy link

codecov bot commented Jul 30, 2021

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.18%. Comparing base (91ee433) to head (01a65ce).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                5.1   #10306   +/-   ##
=========================================
  Coverage     62.18%   62.18%           
  Complexity    34220    34220           
=========================================
  Files          2252     2252           
  Lines        102328   102328           
=========================================
+ Hits          63628    63633    +5     
+ Misses        38700    38695    -5     
Files Coverage Δ
...oreBundle/Controller/AjaxLookupControllerTrait.php 85.71% <100.00%> (+10.71%) ⬆️

... and 1 file with indirect coverage changes

@RCheesley RCheesley added bug Issues or PR's relating to bugs campaigns Anything related to campaigns and campaign builder user-interface Anything related to appearance, layout, and interactivity labels Sep 7, 2021
@RCheesley RCheesley changed the base branch from features to 4.0 September 7, 2021 10:46
@RCheesley RCheesley force-pushed the 4.0 branch 2 times, most recently from bc6f2f8 to 99450ca Compare November 18, 2021 18:36
@patrykgruszka patrykgruszka changed the base branch from 4.0 to 5.x January 12, 2023 08:22
@mabumusa1 mabumusa1 added has-conflicts Pull requests that cannot be merged until conflicts have been resolved T1 Low difficulty to fix (issue) or test (PR) labels Mar 3, 2023
@mabumusa1 mabumusa1 added this to the 5.0-alpha milestone Mar 3, 2023
@mabumusa1
Copy link
Member

@patrykgruszka please fix the conflicts, this PR is easy to test. let's get it across the finish line

@patrykgruszka
Copy link
Member Author

patrykgruszka commented Mar 8, 2023

@mabumusa1 The AjaxLookupControllerTrait file has been removed in this commit 54e30a1 (CC @biozshock). This seems to have been done by accident as the lookup functionality no longer works. I can restore this in my PR, or you can do a separate PR to make this work before merging this PR. Just let me know.

@escopecz escopecz removed this from the 5.0-alpha milestone Jun 20, 2023
@patrykgruszka patrykgruszka force-pushed the fix-ajax-lookup-special-chars branch from 36d19d3 to 5a317c9 Compare September 7, 2023 06:22
@patrykgruszka patrykgruszka added ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging and removed has-conflicts Pull requests that cannot be merged until conflicts have been resolved labels Sep 7, 2023
@patrykgruszka patrykgruszka changed the title Fix search email with special characters in campaign action DPMMA-1020 Fix search email with special characters in campaign action Sep 7, 2023
Copy link
Contributor

@annamunk annamunk left a comment

Choose a reason for hiding this comment

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

✅ fix works fine and the test passes
letsgo

@RCheesley RCheesley added pending-test-confirmation PR's that require one test before they can be merged and removed ready-to-test PR's that are ready to test labels Oct 26, 2023
@RCheesley
Copy link
Member

I'm struggling to reproduce this in the 5.x branch:

Create email: It's an email

Create campaign, add a send email action, search for 'It's an email':

screenshot-8080-mautic-mautic-3183ptn7h2l ws-eu106 gitpod io-2023 11 10-18_46_19

Is it possible this is addressed already?

@RCheesley RCheesley added the pending-feedback PR's and issues that are awaiting feedback from the author label Nov 10, 2023
@patrykgruszka
Copy link
Member Author

@RCheesley I see, it will only work if the email you are looking for is preloaded in the initial list. I've checked this and the backend returns an empty list if the ' character is in the query. That's why in my case the result is displayed next to the "no matches found" message. So this PR still fixes the bug if you have a lot of emails.
image

@patrykgruszka patrykgruszka removed the pending-feedback PR's and issues that are awaiting feedback from the author label Nov 13, 2023
Copy link

@magdalenaleonow magdalenaleonow left a comment

Choose a reason for hiding this comment

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

I tested some special characters, everything works!
image

@patrykgruszka patrykgruszka removed the pending-test-confirmation PR's that require one test before they can be merged label Feb 12, 2024
@RCheesley RCheesley added the user-testing-passed PRs which have been successfully tested by the required number of people. label Mar 22, 2024
@patrykgruszka patrykgruszka changed the base branch from 5.x to 5.1 July 4, 2024 08:28
Copy link
Contributor

@tomekkowalczyk tomekkowalczyk left a comment

Choose a reason for hiding this comment

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

Code looks good

@patrykgruszka patrykgruszka added code-review-passed PRs which have passed code review ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged and removed code-review-needed PR's that require a code review before merging labels Jul 4, 2024
@escopecz escopecz merged commit 914ff02 into mautic:5.1 Jul 15, 2024
@escopecz escopecz added this to the 5.1.1 milestone Jul 15, 2024
escopecz added a commit that referenced this pull request Jul 26, 2024
* Improve grammar for unhide (#13835)

* Improve grammar for unhide

* Fix test

* fix: LeadBundle template errors (#13862)

Co-authored-by: Ruth Cheesley <ruth@ruthcheesley.co.uk>

* [UI] fix CSS flexbox broken in campaign insert clone view (#13878)

* [UI] Replaces table action button `arrow-down` with `more-2` icon (#13841)

* [UI] Replaces table action button `arrow-down` with `more-2` icon

This replaces the icon for the action toggle button in tables (e.g. contact list table or segment list table) with a 3 dot icon.

The previous arrow down icon indicates that an collapsed element would get unfolded/shown. This is not the case in these tables. The button shows more actions. In any UI that I know a 3 dot icon is used for that.

The arrow down icon would be more suitable if it would show more details on click. Hence, this PR.

* TASK: Reverts change for `page_actions.html.twig`

Co-authored-by: Anderson, from Dropsolid <116097999+andersonjeccel@users.noreply.github.com>

---------

Co-authored-by: Anderson, from Dropsolid <116097999+andersonjeccel@users.noreply.github.com>

* add js code to hide profile pic if missing (#13838)

* Segment membership as a new filter for dynamic email content (#13528)

* Merge pull request #1088 from mautic-inc/MAUT-4688

Maut 4688 - Use segment membership as a filter for dynamic content in email

* Changes needed after rebase to M5

* Merge pull request #1407 from acquia/MAUT-5729

MAUT-5729 Dynamic Content Error - Segment Membership filter not showing correct content

* Fixing STAN

* CS fixes

* Test fix

* test fix part 2

* Adding back JS methods removed in a bad conflict resolution

---------

Co-authored-by: Lukáš Drahý <lukas@drahy.net>
Co-authored-by: Rohit Pavaskar <66303837+rohitp19@users.noreply.github.com>
Co-authored-by: Ruth Cheesley <ruth@ruthcheesley.co.uk>

* [UI] Increased icon size (#13825)

* increased icon size

* decrease by 1px

* Make the search regular expression match both "&" and "&amp;" for link replacement within an email body (#13858)

* Guide users to build optimized segments (#13860)

* Merge pull request #2172 from acquia/MAUT-11343

MAUT-11343 : Guide users to build optimized segments

* fix twig file issue

* Apply suggestions from code review

Co-authored-by: John Linhart <admin@escope.cz>

* push suggested changes

---------

Co-authored-by: John Linhart <admin@escope.cz>

* fix CSS flexbox broken in campaign insert clone view

* Revert "[UI] Replaces table action button `arrow-down` with `more-2` icon (#13841)"

This reverts commit fadcf26.

* Revert "Segment membership as a new filter for dynamic email content (#13528)"

This reverts commit 71031b7.

* Revert "[UI] Increased icon size (#13825)"

This reverts commit c00df3c.

* Revert "Make the search regular expression match both "&" and "&amp;" for link replacement within an email body (#13858)"

This reverts commit d3e6ceb.

* Revert "Guide users to build optimized segments (#13860)"

This reverts commit bdabc26.

* Revert "add js code to hide profile pic if missing (#13838)"

This reverts commit 76dd7d6.

---------

Co-authored-by: putzwasser <26040044+putzwasser@users.noreply.github.com>
Co-authored-by: John Linhart <admin@escope.cz>
Co-authored-by: Lukáš Drahý <lukas@drahy.net>
Co-authored-by: Rohit Pavaskar <66303837+rohitp19@users.noreply.github.com>
Co-authored-by: Ruth Cheesley <ruth@ruthcheesley.co.uk>
Co-authored-by: Miroslav Fedeleš <miroslav.fedeles@gmail.com>
Co-authored-by: Saurabh Gupta <48244990+dadarya0@users.noreply.github.com>

* DPMMA-1020 Fix search email with special characters in campaign action (#10306)

* fix: [DPMMA-1020] fix getLookupChoiceListAction for search with special characters

* fix: [DPMMA-1020] phpstan

* fix: focus item published (#13944)

* Update .gitpod.Dockerfile 5.1 branch (#13955)

* fix [DPMMA-2661] mapped field form 5.1 (#13938)

* fix: [DPMMA-2661] Correct form mapper Mautic 5

* feat: [DPMMA-2661] Correct CSFixer

* FIX: Removes onConfigSave which invokes htmlspecialchars and escapes tracking script (#13859)

This fixes #13355

This removes the HTML escaping logic in the onConfigSave method of `ConfigSubscriber`. This change prevents the UI from displaying escaped HTML in the custom tracking JS field after saving the form.

Previously, the form erroneously escaped HTML entities. By removing this code, users will now see the original HTML as expected when they revisit the form.

The main issue, however, was that re-saving  meant saving escaped HTML which would break inserting the tracking HTML code.

**Before**
1. Add custom HTML in `Configuration > Landing Page Settings > Analytics script (i.e. Google Analytics) `
2. Save
3. Open this view again → see escaped HTML
4. Save again
5. Open a landing page and see escaped HTML tracking code injected.

**After**
1. Add custom HTML in `Configuration > Landing Page Settings > Analytics script (i.e. Google Analytics) `
2. Save
3. Open this view again → see unescaped HTML
4. Save again
5. Open a landing page and see correct HTML tracking code injected.

* rename from tweet to tweets (#13967)

* Fix: Create custom fields for lookup list. (#13946)

* FIX: Makes `anniversary` date filter compatible with datetime (#13871)

* FIX: Makes `anniversary` date filter compatible with datetime

* TASK: Fix unit test

* FIX: $expectedResult docstring

---------

Co-authored-by: Ruth Cheesley <ruth@ruthcheesley.co.uk>
Co-authored-by: Frettyl <173093231+Frettyl@users.noreply.github.com>
Co-authored-by: Anderson, from Dropsolid <116097999+andersonjeccel@users.noreply.github.com>
Co-authored-by: putzwasser <26040044+putzwasser@users.noreply.github.com>
Co-authored-by: Lukáš Drahý <lukas@drahy.net>
Co-authored-by: Rohit Pavaskar <66303837+rohitp19@users.noreply.github.com>
Co-authored-by: Miroslav Fedeleš <miroslav.fedeles@gmail.com>
Co-authored-by: Saurabh Gupta <48244990+dadarya0@users.noreply.github.com>
Co-authored-by: Patryk Gruszka <patryk.gruszka@comarch.pl>
Co-authored-by: Tomasz Kowalczyk <39382654+tomekkowalczyk@users.noreply.github.com>
Co-authored-by: Martin Vooremäe <martin.vooremae@gmail.com>
Co-authored-by: Abhisek Mazumdar <abhisekmazumdar@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs campaigns Anything related to campaigns and campaign builder cla-signed The PR contributors have signed the contributors agreement code-review-passed PRs which have passed code review ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged T1 Low difficulty to fix (issue) or test (PR) user-interface Anything related to appearance, layout, and interactivity user-testing-passed PRs which have been successfully tested by the required number of people.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants