sanitize input
This commit is contained in:
@@ -76,11 +76,14 @@ class Settings {
|
|||||||
placeholder: "URL de l'image",
|
placeholder: "URL de l'image",
|
||||||
tags: true,
|
tags: true,
|
||||||
createTag: function (params) {
|
createTag: function (params) {
|
||||||
return {
|
const url = encodeURI(params.term);
|
||||||
id: $.fn.select2.defaults.defaults.escapeMarkup(params.term),
|
if (/^(https?:\/\/.*\.(?:png|jpg|jpeg|gif|bmp|webp|svg))$/i.test(url)) {
|
||||||
text: 'Ajouté manuellement',
|
return {
|
||||||
newTag: true,
|
id: url,
|
||||||
};
|
text: 'Source externe',
|
||||||
|
newTag: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (localStorage['skinURL']) {
|
if (localStorage['skinURL']) {
|
||||||
@@ -91,8 +94,7 @@ class Settings {
|
|||||||
$('#skinURLSelect').val(localStorage['skinURL']).trigger('change');
|
$('#skinURLSelect').val(localStorage['skinURL']).trigger('change');
|
||||||
} else {
|
} else {
|
||||||
var option = new Option(
|
var option = new Option(
|
||||||
localStorage['skinURL'],
|
'Source externe',
|
||||||
'Ajouté manuellement',
|
|
||||||
localStorage['skinURL'],
|
localStorage['skinURL'],
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
|||||||
Reference in New Issue
Block a user