TritonDataCenter / node-manta

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

Custom header input should tolerate ':' characters #312

Closed KodyKantor closed 7 years ago

KodyKantor commented 7 years ago

Let's say that I want to add a custom header to an object that includes a string date, like so:

[root@devzone ~]# mput -H "m-start-time: 2017-06-30T18:35:30Z" -f test.txt ~~/stor

We expect to see a header 'm-start-time' with value '2017-06-30T18:35:30Z', but this is what is actually sent:

[root@devzone ~]# minfo ~~/stor/test.txt
HTTP/1.1 200 OK
etag: fee1aac2-0525-66d7-cfa5-e3e7f3088cb6
last-modified: Fri, 30 Jun 2017 18:35:53 GMT
m-start-time: 2017-06-30T18
...

Notice that the client interpreted '2017-06-30T18:35:30Z' as '2017-06-30T18'. This is due to how this library is parsing arguments.

The offending code for mput is here: https://github.com/joyent/node-manta/blob/a695eb0ffb6f151d8ff0a98bd6a05a6b425eb462/bin/mput#L140 . This pattern is repeated for every command that takes a '-H' argument.

We should probably change this to use joyent/node-strsplit instead. It may be worth looking at reducing boilerplate argument handling code as well.

kellymclaughlin commented 7 years ago

CR to address this is at: https://cr.joyent.us/#/c/2196/