Reputation: 695
I have a script that uses curl to send a file to our third party cloud file storage.
I am using grep to pull out a URL provided to me in an http response
looks like this
curl -X PUT -T media/file.tar.gz -D - \
-H "ETag: ${md5}" \
-H "Content-Type: application/x-gzip" \
-H "${AuthToken}" \
-H "X-Object-Meta-Date: ${today}" \
"${StorageUrl}/dp/file1.tar.gz"
and then I get a bad request on the url which prints out like
'PUT /v1/MossoCloudFS100213=123-123-1233a-ss9\r/dp/file1.tar.gz'
see that \r that just annoyingly has been injected between my variable and the /dp/?
Upvotes: 0
Views: 549
Reputation: 754190
I guess that you got the $StorageUrl
value from a web request and the web response line ended with CRLF (the web standards generally require CRLF line endings). The shell removed the LF (newline) for you, but not the CR (\r
, carriage return). You'll probably need to take care of that yourself before using the URL.
Upvotes: 2