don't show the 'remote image warning' for data URLs in markdown

This commit is contained in:
ansuz 2021-07-06 14:02:29 +05:30
parent aaa18a3feb
commit f652d11ace
1 changed files with 3 additions and 0 deletions

View File

@ -292,6 +292,9 @@ define([
if (typeof(window.URL) === 'undefined') { return false; }
try {
var url = new URL(href, ApiConfig.httpUnsafeOrigin);
// FIXME data URLs can be quite large, but that should be addressed
// in the source markdown's, not the renderer
if (url.protocol === 'data:') { return true; }
var localURL = new URL(ApiConfig.httpUnsafeOrigin);
return url.host === localURL.host;
} catch (err) {