Embedded images not copied when page is copied

Bug #1957725 reported by Kristina Hoeppner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Doris Tam
20.10
Fix Released
High
Unassigned
21.04
Fix Released
High
Unassigned
21.10
Fix Released
High
Unassigned
22.04
Fix Released
High
Doris Tam

Bug Description

When an image is embedded into a text block, the image is not copied along for personal or group pages.

This is related to the ToDo item (at least for the group part): Allow copying of the file artefacts in htdocs/lib/group.php line 3268

In some cases, the image can still be viewed even when access is not explicitly given to the original page. Therefore, the URLs need to be looked at.

We need to copy the image into the group and also change the reference to the block instance so that it relates to the block instance on the group page.

Note: Do not test as site administrator.

To replicate the issue testing in a group:

1. As Student 1, create a personal page with a text block that contains an image and an image block that contains a *different* image (as control example).
2. Share this page with 'Registered people' and make it copyable.
3. Note down the image tag information for the image embedded in the text block. In my case it was: <img alt="andrew-ridley-jR4Zf-riEjI-unsplash.jpg" src="http://domain/artefact/file/download.php?file=140&amp;view=8&amp;embedded=1&amp;text=25" width="640">
4. Create 'Group 1' and copy the page you created into that group.
5. Note down the image information for the embedded image. In my case it was: <img alt="andrew-ridley-jR4Zf-riEjI-unsplash.jpg" src="http://domain/artefact/file/download.php?file=140&amp;view=10&amp;embedded=1&amp;text=25" width="640"> which shows that the file URL and the 'text=25' (the block instance) has not changed. Only the view ID has changed. Also, that image is not copied into the group's files area whereas the image from the image block is found there.
6. Share this page with 'Registered people' and make it copyable.
7. Create 'Group 2' and copy the page from group 1 into this group.
8. Note down the image information for the embedded image. In my case it was: <img alt="andrew-ridley-jR4Zf-riEjI-unsplash.jpg" src="http://mahara.anitsirk.wgtn.cat-it.co.nz/artefact/file/download.php?file=140&amp;view=12&amp;embedded=1&amp;text=25" width="640"> which shows that the file URL and the 'text=25' (the block instance) has not changed. Only the view ID has changed. Also, that image is not copied into the group's files area whereas the image from the image block is found there.
9. Share the page publicly.
10. Remove the sharing permissions for 'Registered people' from Group 1 for the page there.
11. Delete the personal page.
12. View the pages in the groups: They do not contain the image any more because the reference to the original block instance is broken, even though the image still exists in the personal account.

To replicate for personal page:

1. As Student 1, create a personal page with a text block that contains an image and an image block that contains a *different* image (as control example).
2. Share this page with 'Registered people' and make it copyable.
3. Note down the image tag information for the image embedded in the text block. In my case it was: <img alt="andrew-ridley-jR4Zf-riEjI-unsplash.jpg" src="http://domain/artefact/file/download.php?file=140&amp;view=8&amp;embedded=1&amp;text=25" width="640">
4. Log in as Student 2.
5. Copy the page into this account.
6. Note down the image information for the embedded image. In my case it was: <img alt="andrew-ridley-jR4Zf-riEjI-unsplash.jpg" src="http://domain/artefact/file/download.php?file=140&amp;view=10&amp;embedded=1&amp;text=25" width="640"> which shows that the file URL and the 'text=25' (the block instance) has not changed. Only the view ID has changed. Also, that image is not copied into the group's files area whereas the image from the image block is found there.
7. Share this page with 'Public' and make it copyable.
8. Log in as Student 1 and delete the page (but leaving the artefacts in place).
9. View the page in a private window. The image is missing in the text block.

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

Patch for "main" branch: https://reviews.mahara.org/12376

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Closely related to bug 1958509

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

Reviewed: https://reviews.mahara.org/12376
Committed: https://git.mahara.org/mahara/mahara/commit/a98e421946d465c7f064cf3cbe030d7da0878340
Submitter: Robert Lyon (<email address hidden>)
Branch: main

commit a98e421946d465c7f064cf3cbe030d7da0878340
Author: Doris Tam <email address hidden>
Date: Tue Jan 25 15:34:00 2022 +1300

Bug 1957725: Copy embedded artefacts to new owner when copying a page

Note: The artefact_file_embedded table ties blocks
to embedded artefacts

This patch looks exlusively at files mentioned in the $configdata
- $configdata'text']
- $configdata['instructions']

--- Testing instructions ---

1. Create a personal page and allow copying
2. On the personal page, add a text block
3. Insert an image from your uploaded files into the content of the text block
4. Insert an image from your uploaded files into the instructions
5. Create a group
6. Copy your personal page into the group and note the ID of the new page (from the URL)
7. In the Group files area, go into a folder called 'viewfiles' with another folder named by the page ID

Check: The images in the folder matches the images displayed in the group page

Change-Id: I63d6f469cf9b43e7ed38776e06a8efbab985c076

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

Patch for "21.04_DEV" branch: https://reviews.mahara.org/12392

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

Patch for "20.10_DEV" branch: https://reviews.mahara.org/12393

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

Reviewed: https://reviews.mahara.org/12392
Committed: https://git.mahara.org/mahara/mahara/commit/bd1f24b2c826585fea0588f0234c23d518a58bfa
Submitter: Robert Lyon (<email address hidden>)
Branch: 21.04_DEV

commit bd1f24b2c826585fea0588f0234c23d518a58bfa
Author: Doris Tam <email address hidden>
Date: Tue Jan 25 15:34:00 2022 +1300

Bug 1957725: Copy embedded artefacts to new owner when copying a page

Note: The artefact_file_embedded table ties blocks
to embedded artefacts

This patch looks exlusively at files mentioned in the $configdata
- $configdata'text']
- $configdata['instructions']

--- Testing instructions ---

1. Create a personal page and allow copying
2. On the personal page, add a text block
3. Insert an image from your uploaded files into the content of the text block
4. Insert an image from your uploaded files into the instructions
5. Create a group
6. Copy your personal page into the group and note the ID of the new page (from the URL)
7. In the Group files area, go into a folder called 'viewfiles' with another folder named by the page ID

Check: The images in the folder matches the images displayed in the group page

Change-Id: I63d6f469cf9b43e7ed38776e06a8efbab985c076
(cherry picked from commit a98e421946d465c7f064cf3cbe030d7da0878340)

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

Reviewed: https://reviews.mahara.org/12391
Committed: https://git.mahara.org/mahara/mahara/commit/35fdb097f7944add590e37c4651392523df895fb
Submitter: Robert Lyon (<email address hidden>)
Branch: 21.10_DEV

commit 35fdb097f7944add590e37c4651392523df895fb
Author: Doris Tam <email address hidden>
Date: Tue Jan 25 15:34:00 2022 +1300

Bug 1957725: Copy embedded artefacts to new owner when copying a page

Note: The artefact_file_embedded table ties blocks
to embedded artefacts

This patch looks exlusively at files mentioned in the $configdata
- $configdata'text']
- $configdata['instructions']

--- Testing instructions ---

1. Create a personal page and allow copying
2. On the personal page, add a text block
3. Insert an image from your uploaded files into the content of the text block
4. Insert an image from your uploaded files into the instructions
5. Create a group
6. Copy your personal page into the group and note the ID of the new page (from the URL)
7. In the Group files area, go into a folder called 'viewfiles' with another folder named by the page ID

Check: The images in the folder matches the images displayed in the group page

Change-Id: I63d6f469cf9b43e7ed38776e06a8efbab985c076
(cherry picked from commit a98e421946d465c7f064cf3cbe030d7da0878340)

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

Reviewed: https://reviews.mahara.org/12393
Committed: https://git.mahara.org/mahara/mahara/commit/11247d8400abf9b8855489eafc557093ab64b9de
Submitter: Robert Lyon (<email address hidden>)
Branch: 20.10_DEV

commit 11247d8400abf9b8855489eafc557093ab64b9de
Author: Doris Tam <email address hidden>
Date: Tue Jan 25 15:34:00 2022 +1300

Bug 1957725: Copy embedded artefacts to new owner when copying a page

Note: The artefact_file_embedded table ties blocks
to embedded artefacts

This patch looks exlusively at files mentioned in the $configdata
- $configdata'text']
- $configdata['instructions']

--- Testing instructions ---

1. Create a personal page and allow copying
2. On the personal page, add a text block
3. Insert an image from your uploaded files into the content of the text block
4. Insert an image from your uploaded files into the instructions
5. Create a group
6. Copy your personal page into the group and note the ID of the new page (from the URL)
7. In the Group files area, go into a folder called 'viewfiles' with another folder named by the page ID

Check: The images in the folder matches the images displayed in the group page

Change-Id: I63d6f469cf9b43e7ed38776e06a8efbab985c076
(cherry picked from commit a98e421946d465c7f064cf3cbe030d7da0878340)

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.