Revert "Check GET parameters in image embedding"

There's no need to check for every GET parameters (using the line ending
'$' character), we can just add a word boundary (the '\b' character)
instead. Thus, revert commit b939bc7ca8.
This commit is contained in:
Vivien Didelot 2015-02-08 16:09:01 -05:00 committed by Lorenz Hübschle-Schneider
parent e45c2be59f
commit c4bddc993d

View file

@ -250,14 +250,7 @@ plugins.factory('userPlugins', function() {
* Image Preview
*/
var imagePlugin = new UrlPlugin('image', function(url) {
var embed = false;
// Check the get parameters as well, they might contain an image to load
var segments = url.split(/[?&]/).forEach(function(param) {
if (param.match(/\.(png|gif|jpg|jpeg)(:(small|medium|large))?$/i)) {
embed = true;
}
});
if (embed) {
if (url.match(/\.(png|gif|jpg|jpeg)(:(small|medium|large))?\b/i)) {
/* A fukung.net URL may end by an image extension but is not a direct link. */
if (url.indexOf("^https?://fukung.net/v/") != -1) {
url = url.replace(/.*\//, "http://media.fukung.net/imgs/");