Merge pull request #965 from tribut/pastebin-raw
Recognize /raw/ pastebin URLs
This commit is contained in:
commit
77d1c8925b
2 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue