Skip to content

Commit

Permalink
mode/bookmarklets: Check if javascript: url is percent-encoded.
Browse files Browse the repository at this point in the history
  • Loading branch information
hgluka committed Aug 23, 2023
1 parent b9e85ad commit 260de32
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/mode/bookmarklets.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ By default, this mode does nothing but expose the default bookmarklet commands."
(pathname (files:content (make-instance 'files:file :base-path source)))
(string source)))
(source (if (str:starts-with-p "javascript:" source)
(quri:url-decode (subseq source 11))
(let ((source-original (subseq source 11)))
(if (string= source-original (quri:url-decode source-original))
source-original
(progn
(echo-warning "Bookmarklet is not properly percent-encoded.")
"")))
source)))
(ffi-buffer-evaluate-javascript-async buffer source))))
(export 'define-bookmarklet-command)
Expand Down

0 comments on commit 260de32

Please sign in to comment.