TritonDataCenter / node-manta

Node.js SDK for Manta
75 stars 54 forks source link

mls, mfind, et al should handle escaping special chars (e.g. `\r`) when printing paths/names #231

Closed trentm closed 9 years ago

trentm commented 9 years ago
$ echo hi | mput ~~/public/tmp/car/$'before-\r-after'
-after                                  3B
$ mls -j ~~/public/tmp/car
{"name":"before-\r-after","etag":"7fe41e87-5fdf-ea04-d7d6-8c0a99df22f1","size":3,"type":"object","mtime":"2015-06-12T18:37:09.420Z","durability":2,"parent":"/trent.mick/public/tmp/car"}
$ mls ~~/public/tmp/car
-after-
bahamas10 commented 9 years ago

also control characters like ANSI escapes

$ touch "$(tput setaf 1)red"
$ ls
?[31mred
$ echo *
red

ls on os x escapes it, but echo * prints it in a red color

$ echo hi | mput "~~/stor/$(tput setaf 1)red"
/dave.eddy@joyent.com/stor/red                                                                                                                                                                                                                3B                  
$ mls ~~/stor/
red

In both examples above the filename showed up as red