Recognize /raw/ pastebin URLs

This commit is contained in:
Felix Eckhofer 2017-08-30 19:05:36 +02:00
parent d87a2cdfff
commit 1b6ba78acd
No known key found for this signature in database
GPG key ID: B4543DCDE458BF73
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);