Uploading multi-line Caption via upload.smugmug.com
oceanboy
Registered Users Posts: 20 Big grins
When uploading using upload.smugmug.com, the caption can be set by including an X-Smug-Caption: header field. This is fine for simple captions, but fails when the caption contains embedded newlines (and perhaps other characters). Is there a way to encode arbitrary characters during HTTP transport that SmugMug accepts?
0
Comments
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html
So, for example:
It's worth a try...
Please check out my gallery of customisations for the New SmugMug, more to come!
Yes, of course HTTP header fields may extend over multiple lines, but when doing so, the line folding is done for transport only. The line breaks are not part of the header field content. What I'm asking about is the opposite situation: when the content of the header field contains actual line breaks, they must be encoded for transport, so they are not visible at the HTTP level. Among the possibilities are backslash-encoding (per RFC 2616) or RFC 5987 encoding. The key question is, what does SmugMug support? RFC 5987 requires adding a trailing asterisk to the header field name, and the value starts with a charset and then an encoding of the values, so obviously it's a more complex endeavor.
I've tried simple backslash encoding, but I always get an error "Uploading is Temporarily Disabled. Please Retry Later." I think the server is returning the wrong error, that it's actually a problem with the content.
I decided to, as the Australians say, "suck it and see." So I modified my code to do RFC 5987 encoding, and it works!
The caption:
When sent in the X-Smug-Caption header, ends up as:
After the upload, the image caption is correct:
Please check out my gallery of customisations for the New SmugMug, more to come!
I'm about ready to make my shell script available. I use it on MacOS to upload images and videos. It optionally pulls caption and keywords from GraphicConverter for both images and videos, which is something the stock OS X uploaders don't do. It also optionally selected files that either have or don't have a label color set. It also updates images/videos if you've edited the caption or keywords in your local copy.
Weird. Images work fine, but videos drop the caption. The upload code is identical in both cases.