bad paths to embedded media in html exported views

Bug #548308 reported by Frank Phillips
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Richard Mansfield

Bug Description

Hi,

I am experimenting with Mahara v1.2 and I have found that when I generate a html export of a view that includes embedded media files e.g. mov then the main index.html file appears to unnecessarily append the following "&view=10" to the paths to the media. This appears in line 45 and 57 of the attached file. Consequently when I try to view these artefacts the path is invalid. When I manually delete the characters the view and artefacts behave as expected.

This bug was imported from eduforge.org, see:
https://eduforge.org/tracker/index.php?func=detail&aid=3438&group_id=176&atid=739

Revision history for this message
Frank Phillips (mahara) wrote :

Attached index.html.

Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

Had a quick look into this bug.

On the face of things, this is caused by a callback to
replace_download_link in export/html/lib.php->filter().

The preg_quote tries to match & but the link actually contains an & and
therefore doesn't match the preg_quote.

So this is arguably a bug with whatever generates the link in the first
place. The regular expression does the right thing if the ampersand is
correctly entity encoded.

The actual download link comes from
artefact/file/blocktype/internalmedia/lib.php->get_download_link();

I've written a patch which changes &view to &view for internalmedia
which fixes the bug (bugfix_3438 on git.luns.net.uk/mahara.git) but this
doesn't seem to correct the actual display of the href for the media in
view.php - something seems to be getting in the way and entity decoding.

Additionally, the various players use the url generated by
get_download_link() without entity decoding the URL for the - I'm not sure
whether the players handle URLs which have been entity encoded.

Hopefully this saves someone else the time of tracking down the bug.

Revision history for this message
Nigel-catalyst (nigel-catalyst) wrote :

Assigning to RichardM so it's not forgotten about; I didn't have time to look into this before leaving.

Changed in mahara:
milestone: none → 1.3.0
assignee: Richard Mansfield (richard-mansfield) → nobody
Changed in mahara:
assignee: nobody → Richard Mansfield (richard-mansfield)
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

Andrew,

Applying your patch for this doesn't seem to cause any trouble for me, so I've pushed it. But your comment above implies there might be some other page that gets broken. Do you remember what that was about, or do you think it's okay to just apply it?

R.

Changed in mahara:
status: Confirmed → Fix Committed
Changed in mahara:
status: Fix Committed → Fix Released
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

The fix for this was apparently causing breakage in media players on some OSes (see https://bugs.launchpad.net/mahara/+bug/638751). So I reverted this fix (now outputs & rather than & again) and changed replace_download_link in export/html/lib.php->filter() to search for &amp, &, or %26 in the download.php links.

Revision history for this message
Ulises Martínez Miralles (ulmarmir) wrote :

I'm using Mahara 17.04.3.
If we embed Youtube videos with 'https://' it is exported and shows correctly.
If we embed them with 'http://' the URLs are changed to start with '//'.
So if we embed the 'https://www.youtube.com/embed/<id>' it is shown correctly.
If we embed the 'http://www.youtube.com/embed/<id>' it is replaced with the '//www.youtube.com/embed/<id>'.

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

Created bug #1756642 to keep better track of it as this one here was fixed in Mahara 1.3.

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.