From user-return-21854-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Tue Aug 21 16:24:04 2012 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 28A03DD98 for ; Tue, 21 Aug 2012 16:24:04 +0000 (UTC) Received: (qmail 51922 invoked by uid 500); 21 Aug 2012 16:24:02 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 51888 invoked by uid 500); 21 Aug 2012 16:24:02 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 51880 invoked by uid 99); 21 Aug 2012 16:24:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Aug 2012 16:24:02 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sohimor@sapient.com designates 12.130.39.138 as permitted sender) Received: from [12.130.39.138] (HELO webmail.sapient.com) (12.130.39.138) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Aug 2012 16:23:57 +0000 Received: from NAMAIL03.sapient.com ([fe80::1ddd:9f9f:a7cf:31b1]) by NAHUB02.sapient.com ([::1]) with mapi id 14.02.0309.002; Tue, 21 Aug 2012 12:23:36 -0400 From: Stephen Ohimor To: "user@couchdb.apache.org" Subject: RE: Base64 attachment via Futon Thread-Topic: Base64 attachment via Futon Thread-Index: Ac1/sMvgmNwWYcZ6QiCbD6sLC3viUwAJyDaAAAhFzKA= Date: Tue, 21 Aug 2012 16:23:36 +0000 Message-ID: <326B8AB680B15249B86A3DB3D1FBB3EE07EA64D1@NAMAIL03.sapient.com> References: <326B8AB680B15249B86A3DB3D1FBB3EE07EA648B@NAMAIL03.sapient.com> <5F64F1AA-9A7B-4552-950D-8CDF335B4F67@couchbase.com> In-Reply-To: <5F64F1AA-9A7B-4552-950D-8CDF335B4F67@couchbase.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.216.14.28] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org 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 "Con= tent-Type: application/json" 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 com= mons codec. This (unfortunately) produces a string with line breaks. Couc= hDB 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 in= to used the base64.encodeBase64URLSafeString in commons codec which is su= pposed to generate a string with no line breaks and url safe characters. I= 'm beginning to think the latter is not supported. =20 I'm looking into removing newline characters from the generated base64'd at= tachment, 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 l= ine breaks in base encoded strings? Lastly, about your P.S. If you go to http://couchdb.apache.org/ and look at= the Download Section. There label says Windows(R15B). =20 =20 -----Original Message----- From: Jens Alfke [mailto:jens@couchbase.com]=20 Sent: Tuesday, August 21, 2012 12:03 PM To: user@couchdb.apache.org Subject: Re: Base64 attachment via Futon On Aug 21, 2012, at 8:22 AM, Stephen Ohimor wrote: > Context: I'm posting a document with an attachment. The attachment is a= Base64 url-safe encoded string. I am posting to a local CouchDB server (R= 15B) via the Futon Interface. Why use that API? My understanding is that Futon's API is considered intern= al, and not supported. It's quite easy to upload attachments using a regular PUT/POST to the docum= ent URL. You can embed the base64'd attachment in the JSON, or you can post= in MIME multipart format and send the attachment raw. -Jens PS: Also, I just noticed you said R15B - that's the version of *Erlang*, no= t of CouchDB. To see the CouchDB version, GET /.