Skip to content

Commit

Permalink
(Issue #1106) Whitelist embeds from vine
Browse files Browse the repository at this point in the history
Whitelists embeds using the simple format, not the postcard format.
  • Loading branch information
hotlevel4 committed Feb 27, 2015
1 parent 22fef05 commit e8ee7d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cgi-bin/DW/Hooks/EmbedWhitelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ my %host_path_match = (

"imgur.com" => [ qr!^/a/.+?/embed!, 1 ],

"vine.co" => [ qr!^/v/[a-zA-Z0-9]{11}/embed/simple$!, 1 ],
# Videos seemed to use an 11-character identification; may need to be changed

);

LJ::Hooks::register_hook( 'allow_iframe_embeds', sub {
Expand Down
7 changes: 6 additions & 1 deletion t/embed-whitelist.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use strict;
use warnings;

use Test::More tests => 49;
use Test::More tests => 53;

use lib "$ENV{LJHOME}/cgi-bin";
BEGIN { $LJ::_T_CONFIG = 1; require 'ljlib.pl'; }
Expand Down Expand Up @@ -129,6 +129,11 @@ note( "misc" );
test_good_url( "http://www.npr.org/templates/event/embeddedVideo.php?storyId=326182003&mediaId=327658636" );

test_good_url( "//imgur.com/a/J4OKE/embed" );

test_good_url( "https://vine.co/v/bjHh0zHdgZT/embed/simple" );
test_bad_url( "https://vine.co/v/bjHh0zHdgZT/embed/postcard" );
test_bad_url( "https://vine.co/v/bjHh0zHdgZT/embed" );
test_bad_url( "https://vine.co/v/abc/embed/simple" );
}


0 comments on commit e8ee7d8

Please sign in to comment.