Fix special link on admin sessions

This commit is contained in:
Nicolas H 2022-04-13 18:56:52 +02:00
parent 325bcf8746
commit 913cef9caf
1 changed files with 5 additions and 2 deletions

View File

@ -9,6 +9,8 @@
var external = RegExp('^((f|ht)tps?:)?//');
var javascript = RegExp('^javascript:');
var textual = RegExp('\.md$');
var internal = RegExp('^\/:');
var editor;
var emoji;
var editfile="";
@ -304,12 +306,13 @@ function alertBox(message, className) {
function openlink(dest,majtree)
{
$("#content").html('<div class="container h-100"><div class="row h-100 justify-content-center align-items-center"><div class="col-12 fa-3x container"><i class="fas fa-spinner fa-spin"></i></div></div></div>');
if (dest.match(/.(jpg|jpeg|png|gif|webp|svg|ico)$/i))
{
imagemode(dest);
return;
}
if (!dest.match(/.(md|txt)$/i))
if (!dest.match(/.(md|txt)$/i) && !dest.match(/:.*$/i))
{
nomode(dest);
return;
@ -462,7 +465,7 @@ function majlink(context)
{
$('#'+context+' a').click(function(e) {
dest=$(this).attr('href');
if (!external.test(dest) && !javascript.test(dest))
if (!external.test(dest) && !javascript.test(dest) && (textual.test(dest) || internal.test(dest)))
{
e.preventDefault();
openlink(dest,true);