Artefact blog upgrade gives error for embedded image

Bug #1612451 reported by Robert Lyon on 2016-08-11
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Robert Lyon
15.04
High
Unassigned
15.10
High
Unassigned
16.04
High
Unassigned
16.10
High
Robert Lyon

Bug Description

This error:

Artefact with id 6 not found
Call stack (most recent first):
    artefact_instance_from_id("6") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/embeddedimage.php:79
    EmbeddedImage::prepare_embedded_images(" <p>This is a test</p> <p><img width="155" heig...", "blogpost", "7", null, "1") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/db/upgrade.php:76

Occurs when a Journal post (blogpost) has an embedded image <img> tag in it but the underlying image itself has been deleted.

We need to adjust EmbeddedImage::prepare_embedded_images() to check that the underlying image artefact still exists

Mahara Bot (dev-mahara) wrote :

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

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

commit f7470234c8be263368988cd712b25782dd7dfd48
Author: Aaron Wells <email address hidden>
Date: Tue Aug 9 17:41:10 2016 +1200

Bug 1612451: Graceful handling of invalid embedded artefact id

Adds a try/catch block so that the code doesn't crash if
you've put in an invalid image ID in an embedded image tag.
Also tweaks the embed code so that it will skip invalid
images but continue processing the rest of the text block.

behatnotneeded: Covered by existing tests

Change-Id: I573adc7d29a0c1a4289f1b0a0b402d308a739be9

Mahara Bot (dev-mahara) wrote :

Patch for "15.10_STABLE" branch: https://reviews.mahara.org/6833

Mahara Bot (dev-mahara) wrote :

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/6834

Reviewed: https://reviews.mahara.org/6832
Committed: https://git.mahara.org/mahara/mahara/commit/4f88e345b7c0b2e30af803b2a46167668dc98040
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit 4f88e345b7c0b2e30af803b2a46167668dc98040
Author: Aaron Wells <email address hidden>
Date: Tue Aug 9 17:41:10 2016 +1200

Bug 1612451: Graceful handling of invalid embedded artefact id

Adds a try/catch block so that the code doesn't crash if
you've put in an invalid image ID in an embedded image tag.
Also tweaks the embed code so that it will skip invalid
images but continue processing the rest of the text block.

behatnotneeded: Covered by existing tests

Change-Id: I573adc7d29a0c1a4289f1b0a0b402d308a739be9
(cherry picked from commit f7470234c8be263368988cd712b25782dd7dfd48)

Mahara Bot (dev-mahara) wrote :

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

commit 6ada1f7a9b6fa56cfec841635a99c54029b56c65
Author: Aaron Wells <email address hidden>
Date: Tue Aug 9 17:41:10 2016 +1200

Bug 1612451: Graceful handling of invalid embedded artefact id

Adds a try/catch block so that the code doesn't crash if
you've put in an invalid image ID in an embedded image tag.
Also tweaks the embed code so that it will skip invalid
images but continue processing the rest of the text block.

behatnotneeded: Covered by existing tests

Change-Id: I573adc7d29a0c1a4289f1b0a0b402d308a739be9
(cherry picked from commit f7470234c8be263368988cd712b25782dd7dfd48)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6834
Committed: https://git.mahara.org/mahara/mahara/commit/2327631a381eb139ad093a650a4d5627616f0ea6
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 2327631a381eb139ad093a650a4d5627616f0ea6
Author: Aaron Wells <email address hidden>
Date: Tue Aug 9 17:41:10 2016 +1200

Bug 1612451: Graceful handling of invalid embedded artefact id

Adds a try/catch block so that the code doesn't crash if
you've put in an invalid image ID in an embedded image tag.
Also tweaks the embed code so that it will skip invalid
images but continue processing the rest of the text block.

behatnotneeded: Covered by existing tests

Change-Id: I573adc7d29a0c1a4289f1b0a0b402d308a739be9
(cherry picked from commit f7470234c8be263368988cd712b25782dd7dfd48)

Robert Lyon (robertl-9) on 2016-10-21
Changed in mahara:
milestone: 16.10.0 → none
Robert Lyon (robertl-9) on 2016-10-25
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers