diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-24 13:57:49 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-24 14:00:15 +0100 |
commit | b27deb7672c53e3ee59f91b7091e83ab28a8318d (patch) | |
tree | cb8990de9e0d08baf437b447be5fa631dc908258 /src | |
parent | 91150588036fc3d8611f659fad063138e25b2cd8 (diff) | |
download | chawan-b27deb7672c53e3ee59f91b7091e83ab28a8318d.tar.gz |
pager: detect JS as text
hack so it's possible to view JS code in a buffer even if it's set as e.g. application/javascript in user mime.types
Diffstat (limited to 'src')
-rw-r--r-- | src/local/pager.nim | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index b8041236..5bd51fed 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -42,6 +42,7 @@ import types/cookie import types/opt import types/url import types/winattrs +import utils/mimeguess import utils/strwidth import utils/twtstr @@ -1603,7 +1604,10 @@ proc connected(pager: Pager; container: Container; response: Response) = container.contentType.get & ";charset=" & $container.charset let mailcapRes = pager.checkMailcap(container, istream, response.outputId, realContentType) - if not mailcapRes.found and not realContentType.startsWithIgnoreCase("text/"): + let shortContentType = container.contentType.get + if not mailcapRes.found and + not shortContentType.startsWithIgnoreCase("text/") and + not shortContentType.isJavaScriptType(): pager.askDownloadPath(container, response) return if mailcapRes.connect: |