Bug #5811

JSON ampersand encoding on the featured videos flash player

Added by yossarian over 2 years ago. Updated over 2 years ago.

Status:New Start:12/16/2009
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:-
Target version:-
Resolution:


Description

On the DK site (but could be any site) we just had a problem where the featured videos JSON string was being returned as:

vids=[{"file_path":"/system/video/2009/12/16/1875/sj_buckley-indiancommunitydelegationburntheirbadges852.wmv.small.jpg","title":"Indian delegation burn Cop15 badges","json_class":"VideoSummary","id":1875},{"file_path":"/system/video/2009/12/16/1828/sytaffel-sixhoursoftortureincopenhagen540.mov.small.jpg","title":"Six Hours of Torture in Copenhagen","json_class":"VideoSummary","id":1828},{"file_path":"/system/video/2009/12/14/1722/mov00095.mp4.small.jpg","title":"Dog bite press & pissed off police","json_class":"VideoSummary","id":1722}]

The ampersand in the last title was not being &amp encoded, breaking the featured videos player.

History

Updated by Barney over 2 years ago

Confirmed on current site in git. To reproduce: edit the featured video to put an ampersand in the title, then view
<site>/featured_videos_json. You get, for example:

vids=[{"file_path":"/system/video/2008/12/23/6/fight_test.wmv.small.jpg","title":"Street fight tutorial & what about the json","json_class":"VideoSummary","id":6}]

And the flash player dies.

Updated by Barney over 2 years ago

I think this can be fixed only in the flash player, not the json output. I think the json output is correct, as its JSON, not html, and shouldn't need html encoding.

I tried modifying to produce html encoding (see patch), but this doesn't actually help, as the flash player still appears. The patch is ugly anyway, as html_encode should have no place in a controller.

I have no clue about flash, so I'm going to give up.

Updated by Barney over 2 years ago

I tried modifying to produce html encoding (see patch), but this doesn't actually help, as the flash player still appears. The patch is ugly anyway, as html_encode should have no place in a controller.

Sorry, by still appears I meant still appears broken, or still fails to appear.

Also available in: Atom PDF