Recognize /raw/ pastebin URLs

new-cordova-2
Felix Eckhofer 8 years ago
parent d87a2cdfff
commit 1b6ba78acd
No known key found for this signature in database
GPG Key ID: B4543DCDE458BF73
  1. 4
      js/plugins.js
  2. 1
      test/unit/plugins.js

@ -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…
Cancel
Save