Skip to content

Commit

Permalink
FIX: Onebox instagram links that contain the username profile
Browse files Browse the repository at this point in the history
  • Loading branch information
romanrizzi committed Apr 11, 2019
1 parent eba1f3e commit 912d579
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/onebox/engine/instagram_onebox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class InstagramOnebox
include StandardEmbed
include LayoutSupport

matches_regexp(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/p\//)
matches_regexp(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/[a-zA-Z0-9]+\/p\//)
always_https

def data
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/onebox/engine/instagram_onebox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@
it "includes description" do
expect(html).to include("1.2m Likes, 6,100 Comments - National Geographic (@natgeo) on Instagram")
end

it 'Oneboxes links that include the username' do
link_with_profile = 'https://www.instagram.com/bennyblood24/p/Brc6FNRn9vu/'
onebox_klass = Onebox::Matcher.new(link_with_profile).oneboxed
expect(onebox_klass.name).to eq(described_class.name)
end
end

2 comments on commit 912d579

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/instagram-oneboxing/69099/89

@arpitjalan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.