summaryrefslogtreecommitdiff
path: root/share/www/script/couch.js
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-09-09 11:12:36 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-09-09 11:12:36 +0000
commit37ca97c918f4b5316e4293d8f1001bb87b8dfb0c (patch)
treee26fda143521e2fa2935ba657d8f00f22c3e5d9a /share/www/script/couch.js
parentb8e510ba813f9b5a24483e16dd6a9971b31dc876 (diff)
Fix for attachment content-type conversion from/to binary in RESTful API.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@693435 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/couch.js')
-rw-r--r--share/www/script/couch.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js
index 2f15737d..cf26bb2e 100644
--- a/share/www/script/couch.js
+++ b/share/www/script/couch.js
@@ -243,22 +243,22 @@ CouchDB.request = function(method, uri, options) {
CouchDB.uuids_cache = [];
CouchDB.newUuids = function(n) {
- if (CouchDB.uuids_cache.length >= n) {
- var uuids = CouchDB.uuids_cache.slice(CouchDB.uuids_cache.length - n);
- if(CouchDB.uuids_cache.length - n == 0) {
- CouchDB.uuids_cache = [];
- } else {
- CouchDB.uuids_cache =
- CouchDB.uuids_cache.slice(0, CouchDB.uuids_cache.length - n);
- }
- return uuids;
+ if (CouchDB.uuids_cache.length >= n) {
+ var uuids = CouchDB.uuids_cache.slice(CouchDB.uuids_cache.length - n);
+ if(CouchDB.uuids_cache.length - n == 0) {
+ CouchDB.uuids_cache = [];
} else {
- var req = CouchDB.request("POST", "/_uuids?count=" + (100 + n));
- var result = JSON.parse(req.responseText);
- if (req.status != 200)
- throw result;
CouchDB.uuids_cache =
- CouchDB.uuids_cache.concat(result.uuids.slice(0, 100));
- return result.uuids.slice(100);
+ CouchDB.uuids_cache.slice(0, CouchDB.uuids_cache.length - n);
}
+ return uuids;
+ } else {
+ var req = CouchDB.request("POST", "/_uuids?count=" + (100 + n));
+ var result = JSON.parse(req.responseText);
+ if (req.status != 200)
+ throw result;
+ CouchDB.uuids_cache =
+ CouchDB.uuids_cache.concat(result.uuids.slice(0, 100));
+ return result.uuids.slice(100);
}
+}