Merge pull request #965 from tribut/pastebin-raw

Recognize /raw/ pastebin URLs
This commit is contained in:
Lorenz Hübschle-Schneider 2017-08-31 09:42:51 +02:00 committed by GitHub
commit 77d1c8925b
2 changed files with 3 additions and 2 deletions

View file

@ -473,10 +473,10 @@ plugins.factory('userPlugins', function() {
});
var pastebinPlugin = new UrlPlugin('Pastebin', function(url) {
var regexp = /^https?:\/\/pastebin\.com\/([^.?]+)/i;
var regexp = /^https?:\/\/pastebin\.com\/(raw\/)?([^.?]+)/i;
var match = url.match(regexp);
if (match) {
var id = match[1],
var id = match[2],
embedurl = "https://pastebin.com/embed_iframe/" + id,
element = angular.element('<iframe></iframe>')
.attr('src', embedurl)

View file

@ -146,6 +146,7 @@ describe('filter', function() {
it('should recognize pastebins', inject(function(plugins) {
expectTheseMessagesToContain([
'http://pastebin.com/Wn3TetSE',
'http://pastebin.com/raw/Wn3TetSE',
],
'Pastebin',
plugins);