Comment text being saved with extra HTML tags

Bug #1826948 reported by Rebecca Blundell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Unassigned

Bug Description

In 18.04 we made a change which meant we inadvertently started saving comment text like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p>comment text</p></body></html>

instead of like this:
<p>comment text</p>

this is because a call to loadHTML() adds the extra tags unless passed in flags tell it not to.

As well as fixing this problem, we need to check that other places in the code that use loadHTML() are not also adding extra tags.

Steps to reproduce:

1. Add a comment
2. Check the database and check what is stored in the artefact table for the text of that comment

What you should see:
The text of the comment you added inside <p> tags

What you currently see:
The text of the comment you added inside the doctype and body tags as well.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/9912

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/9913

Robert Lyon (robertl-9)
Changed in mahara:
status: New → In Progress
importance: Undecided → High
milestone: none → 19.04.0
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9912
Committed: https://git.mahara.org/mahara/mahara/commit/8a9170d8a6af3e008846ab02e43924f3f9fe6d45
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 8a9170d8a6af3e008846ab02e43924f3f9fe6d45
Author: Rebecca Blundell <email address hidden>
Date: Tue Apr 30 12:03:42 2019 +1200

Bug 1826948: Stop comment text being saved with extra tags

added flags to loadHTML to stop it adding doctype and body
tags to the comment.

behatnotneeded

Change-Id: I9c9b7fd7f58a6db793212e6f82be56d3d46f3eeb

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/9913
Committed: https://git.mahara.org/mahara/mahara/commit/9a42c68064f7c3293677d3ca5f5a5d8cf89d498a
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 9a42c68064f7c3293677d3ca5f5a5d8cf89d498a
Author: Cecilia Vela Gurovic <email address hidden>
Date: Tue Apr 30 12:32:20 2019 +1200

Bug 1826948: update existing comments

behatnotneeded

Change-Id: I71bcdb6c98aa1382692a93db2399547e71838f19

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "19.04_STABLE" branch: https://reviews.mahara.org/9926

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9926
Committed: https://git.mahara.org/mahara/mahara/commit/6e4540101a32293cd12197d0babc0144ed429410
Submitter: Robert Lyon (<email address hidden>)
Branch: 19.04_STABLE

commit 6e4540101a32293cd12197d0babc0144ed429410
Author: Rebecca Blundell <email address hidden>
Date: Tue Apr 30 12:03:42 2019 +1200

Bug 1826948: Stop comment text being saved with extra tags

added flags to loadHTML to stop it adding doctype and body
tags to the comment.

behatnotneeded

Change-Id: I9c9b7fd7f58a6db793212e6f82be56d3d46f3eeb
(cherry picked from commit 8a9170d8a6af3e008846ab02e43924f3f9fe6d45)

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "19.04_STABLE" branch: https://reviews.mahara.org/9927

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9927
Committed: https://git.mahara.org/mahara/mahara/commit/3d5e8862ba30f066e689ba40820b169b43af6a3c
Submitter: Robert Lyon (<email address hidden>)
Branch: 19.04_STABLE

commit 3d5e8862ba30f066e689ba40820b169b43af6a3c
Author: Cecilia Vela Gurovic <email address hidden>
Date: Tue Apr 30 12:32:20 2019 +1200

Bug 1826948: update existing comments

behatnotneeded

Change-Id: I71bcdb6c98aa1382692a93db2399547e71838f19

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.