Stop trurl from encoding colons in query-less URLs
Tracking params only live in the query string, so running trurl on a
query-less URL trims nothing but still percent-encodes path colons,
breaking bsky `did:plc:…` links. Skip it when there is no query.

Assisted-by: Claude Opus 4.8 via Claude Code
change vlmmyylkzsqqpokpuropzlqswyzpoxyz
commit 35e533448947c0e890f12969e3c8e141f1964182
author Alpha Chen <alpha@kejadlen.dev>
date
parent lvtqrsuu
diff --git a/.hammerspoon/init.fnl b/.hammerspoon/init.fnl
index bc064908..53954063 100644
--- a/.hammerspoon/init.fnl
+++ b/.hammerspoon/init.fnl
@@ -96,8 +96,13 @@
                                :start true})
 
 (fn sanitize-url [url]
-  ;; Skip AWS SSO URLs — trurl encodes slashes in hash-routed fragments.
-  (if (string.match url "%.awsapps%.com/start/#/")
+  ;; Skip trurl when it would do harm without benefit:
+  ;; - AWS SSO URLs — trurl encodes slashes in hash-routed fragments.
+  ;; - Query-less URLs — tracking params only live in the query, so there
+  ;;   is nothing to trim, and trurl percent-encodes path colons
+  ;;   (e.g. bsky's `did:plc:…` becomes `did%3aplc%3a…`).
+  (if (or (string.match url "%.awsapps%.com/start/#/")
+          (not (string.find url "?" 1 true)))
       url
       (let [tracking-params [:utm_* :uta_* :fbclid :gclid]
             trurl-cmd (.. :/opt/homebrew/bin/trurl " "