Skip to content

Commit

Permalink
Use ERb’s utility function for URL escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
sorbits committed Jan 19, 2019
1 parent 2bee99c commit 741e9e9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Commands/Convert Line : Selection to URL Escapes.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby20
print STDIN.read.gsub(/([^a-zA-Z0-9_.-]+)/n) {
'%' + $1.unpack('H2' * $1.bytes.size).join('%').upcase
}
require 'erb'
print ERB::Util.url_encode(STDIN.read)
</string>
<key>fallbackInput</key>
<string>line</string>
Expand Down

0 comments on commit 741e9e9

Please sign in to comment.