Error trying to use an embed code with line breaks

Bug #1421444 reported by Aaron Wells on 2015-02-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Aaron Wells

Bug Description

I noticed this while testing out a Kaltura embed code that was mentioned on the mahara.org forums: https://mahara.org/interaction/forum/topic.php?id=6693&offset=0&limit=10#post28253

I noticed that the embed code provided by the user worked in Mahara 1.9 & 1.10, but not in 15.04dev. When I tried to enter this embed code in 15.04dev, I received a form validation error: "Invalid URL or embed code".

After running git bisect, I discovered that it was a problem in the validation regex we added for Bug 1381807. Specifically, the regex errors out when trying to validate an embed code that contains line breaks. If I delete the line breaks and make the embed code all one line, it works.

Aaron Wells (u-aaronw) on 2015-02-12
Changed in mahara:
importance: High → Medium
Aaron Wells (u-aaronw) wrote :

To test:

1. Put an "External media" block in a Page

2. Enter an embed code into the block, and verify that it works. For instance, this one from YouTube:

<iframe width="420" height="315" src="https://www.youtube.com/embed/sVMhuiHm50I" frameborder="0" allowfullscreen></iframe>

3. Save the block and verify that the embed code works.

4. Edit the external media block, and insert a line break into the embed code. Like this:

<iframe width="420" height="315" src="https://www.youtube.com/embed/sVMhuiHm50I" frameborder="0" allowfullscreen></iframe>

Expected result: You should see the contents of the embed code as before

Actual result: The form fails validation, with the error message "Invalid URL or embed code"

Aaron Wells (u-aaronw) wrote :

Um, typo above. The embed code in step 4 is supposed to have a line break before the closing <iframe> tag. Like this:

<iframe width="420" height="315" src="https://www.youtube.com/embed/sVMhuiHm50I" frameborder="0" allowfullscreen>
</iframe>

Reviewed: https://reviews.mahara.org/4273
Committed: http://gitorious.org/mahara/mahara/commit/f6cafa680f85e0bdf7f6d66e5c928385b7e56419
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit f6cafa680f85e0bdf7f6d66e5c928385b7e56419
Author: Aaron Wells <email address hidden>
Date: Fri Feb 13 12:25:07 2015 +1300

Make the embed code regex accept newlines

Bug 1421444

Change-Id: I9bfc571d55a2916f89bdef980b5db316715530e1

Robert Lyon (robertl-9) on 2015-02-12
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2015-04-17
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