* [PATCH] dtas-tl edit: do not shell-escape text file
@ 2022-11-13 21:23 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2022-11-13 21:23 UTC (permalink / raw)
To: dtas-all
There's no need to shell-escape the text file in most cases, so
make the display of non-ASCII characters more pleasant to users
with UTF-8-capable terminals and editors.
---
bin/dtas-tl | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/bin/dtas-tl b/bin/dtas-tl
index e58ee31..7659570 100755
--- a/bin/dtas-tl
+++ b/bin/dtas-tl
@@ -43,7 +43,8 @@ def do_edit(c)
track_id = $1.to_i
orig_idx[track_id] = orig.size
orig << track_id
- tmp.write("#{Shellwords.escape(line)} =#{track_id}\n")
+ line = Shellwords.escape(line) if line.include?("\n")
+ tmp.write("#{line} =#{track_id}\n")
end
tmp.flush
@@ -100,13 +101,8 @@ def do_edit(c)
non_existent = []
add.each do |path, after_id|
orig = path
- path = Shellwords.split(path)[0]
- path = File.expand_path(path)
- unless File.exist?(path)
- path = orig.dup
- path = Shellwords.split(path)[0]
- path = File.expand_path(path)
- end
+ path = File.expand_path(orig)
+ path = File.expand_path(Shellwords.split(path)[0]) unless File.exist?(path)
if File.exist?(path)
cmd = %W(tl add #{path})
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-11-13 21:23 7% [PATCH] dtas-tl edit: do not shell-escape text file Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/dtas.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).