From cb7a3cf7a47bdcf2366efb06e7e4c056394fcfd3 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 14 Feb 2022 09:22:31 +0200 Subject: Added option for autoshowing images in data URLs Disabled by default to be consistent with behavior of other links. --- src/gmdocument.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gmdocument.c') diff --git a/src/gmdocument.c b/src/gmdocument.c index 5cae4138..a3e233f3 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c @@ -334,7 +334,7 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li setRange_String(&link->url, link->urlRange); set_String(&link->url, canonicalUrl_String(absoluteUrl_String(&d->url, &link->url))); /* If invalid, disregard the link. */ - if (size_String(&link->url) > prefs_App()->maxUrlSize || + if ((d->format == gemini_SourceFormat && size_String(&link->url) > prefs_App()->maxUrlSize) || (startsWithCase_String(&link->url, "about:command") /* this is a special internal page that allows submitting UI events */ && !d->enableCommandLinks)) { @@ -371,7 +371,11 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li } else if (equalCase_Rangecc(parts.scheme, "data")) { setScheme_GmLink_(link, data_GmLinkScheme); - if (startsWith_Rangecc(parts.path, "image/")) { + if (startsWith_Rangecc(parts.path, "image/png") || + startsWith_Rangecc(parts.path, "image/jpg") || + startsWith_Rangecc(parts.path, "image/jpeg") || + startsWith_Rangecc(parts.path, "image/webp") || + startsWith_Rangecc(parts.path, "image/gif")) { link->flags |= imageFileExtension_GmLinkFlag; } } -- cgit v1.2.3