incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <d...@muse.net.nz>
Subject Re: Base64 attachment via Futon
Date Tue, 21 Aug 2012 17:58:40 GMT
On 21 August 2012 18:23, Stephen Ohimor <sohimor@sapient.com> wrote:
> Jens,
>
> A bit of clarification on my behalf.  I'm doing a POST using the following command:
>
>         curl --data @nonBreak.json http://localhost:5984/source_data --header "Content-Type:
application/json"

Ensure your file is utf-8 clean, and use --data-binary or "-T".  Can
you redo the curl with -v & send back the output?

Also, feel free to send a link to the json if this is clean & still not working.

> The issue is embedding base64'd attachment in the JSON.  I would prefer to refrain from
using MIME as other data needs to be sent with the attachment.  I've attempted to POST with
two different types of base64'd attachments.  I've attempted to use the standard conversion
made available by apache commons codec.  This (unfortunately) produces a string with line
breaks.  CouchDB documentation states that there can be no line breaks (I assume due to the
syntax of JSON and the result not being parsed correctly).  I looked into used the base64.encodeBase64URLSafeString
  in commons codec which is supposed to generate a string with no line breaks and url safe
characters.  I'm beginning to think the latter is not supported.
>
> I'm looking into removing newline characters from the generated base64'd attachment,
however when I scan the string (java: content.replace((\r\n|\n|\r),"")) nothing appears to
be removed from the string.
>
> Does CouchDB support url-safe base64Encoded strings?  If not (and this may be more of
a java related issue) are there any libraries that will remove line breaks in base encoded
strings?

This triggers my memory, but not enough to help sorry! So hopefully
the java gods can advise? Do you have a small test case?

> Lastly, about your P.S. If you go to http://couchdb.apache.org/ and look at the Download
Section.  There label says Windows(R15B).

@Jens, I'll see about fixing that, thanks.
@Stephen We provide 2 windows bundles, with different Erlang/OTP
releases. They are both CouchDB 1.2.0 though inside.

A+
Dave

Mime
View raw message