about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-24 13:57:49 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-24 14:00:15 +0100
commitb27deb7672c53e3ee59f91b7091e83ab28a8318d (patch)
treecb8990de9e0d08baf437b447be5fa631dc908258 /src
parent91150588036fc3d8611f659fad063138e25b2cd8 (diff)
downloadchawan-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.nim6
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: