about summary refs log tree commit diff stats
path: root/src/local/pager.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-12-10 17:48:27 +0100
committerbptato <nincsnevem662@gmail.com>2023-12-10 17:48:27 +0100
commitc85dfb6a369ea1e9fc4b1f4cd7dba2b9d7b75483 (patch)
tree95c7eeaaa270c7a4824e0ac6cf805a30c8d607c3 /src/local/pager.nim
parent48b197133783bf7ec7211b1e114b6ca73f36a3c6 (diff)
downloadchawan-c85dfb6a369ea1e9fc4b1f4cd7dba2b9d7b75483.tar.gz
mailcap: add $MAILCAP_URL
This is better than %u as it is backwards compatible (i.e. does not rely on
other user agents doing whatever upon encountering an unknown substitution
template.)
Diffstat (limited to 'src/local/pager.nim')
-rw-r--r--src/local/pager.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim
index 388c5448..6977a4eb 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -1122,6 +1122,7 @@ proc checkMailcap(pager: Pager, container: Container): (EmptyPromise, bool) =
       tempfile
     var canpipe = true
     let cmd = unquoteCommand(entry.cmd, contentType, outpath, url, cs, canpipe)
+    putEnv("MAILCAP_URL", $url)
     if {COPIOUSOUTPUT, HTMLOUTPUT} * entry.flags == {}:
       # no output.
       if canpipe:
@@ -1133,6 +1134,7 @@ proc checkMailcap(pager: Pager, container: Container): (EmptyPromise, bool) =
         return pager.runMailcapReadPipe(container, entry[], cmd)
       else:
         return pager.runMailcapReadFile(container, entry[], cmd, outpath)
+    delEnv("MAILCAP_URL")
   return (nil, true)
 
 proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bool =