Commit 13aa9c7b authored by Romain Courteaud's avatar Romain Courteaud

Lint: do not redefine the same variable

parent 82ac0448
...@@ -140,8 +140,9 @@ ...@@ -140,8 +140,9 @@
that._key, buf); that._key, buf);
}) })
.push(function (coded) { .push(function (coded) {
var blob = new Blob([initializaton_vector, coded], {type: MIME_TYPE}); var final_blob = new Blob([initializaton_vector, coded],
return that._sub_storage.putAttachment(id, name, blob); {type: MIME_TYPE});
return that._sub_storage.putAttachment(id, name, final_blob);
}); });
}; };
......
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
var i, var i,
attachment = {}, attachment = {},
id, new_id,
attachment_list = new DOMParser().parseFromString( attachment_list = new DOMParser().parseFromString(
response.target.responseText, response.target.responseText,
"text/xml" "text/xml"
...@@ -196,11 +196,11 @@ ...@@ -196,11 +196,11 @@
// exclude parent folder and browse // exclude parent folder and browse
for (i = 1; i < attachment_list.length; i += 1) { for (i = 1; i < attachment_list.length; i += 1) {
// XXX Only get files for now // XXX Only get files for now
id = attachment_list[i].querySelector("D\\:href, href"). new_id = attachment_list[i].querySelector("D\\:href, href").
textContent.split('/').slice(-1)[0]; textContent.split('/').slice(-1)[0];
// XXX Ugly // XXX Ugly
if ((id !== undefined) && (id !== "")) { if ((new_id !== undefined) && (new_id !== "")) {
attachment[id] = {}; attachment[new_id] = {};
} }
} }
return attachment; return attachment;
......
...@@ -292,9 +292,9 @@ ...@@ -292,9 +292,9 @@
return jIO.util.readBlobAsText(error.target.response); return jIO.util.readBlobAsText(error.target.response);
}) })
.push(function (evt) { .push(function (evt) {
var err_content = JSON.parse(evt.target.result); var err_content2 = JSON.parse(evt.target.result);
if ((err_content.error['.tag'] === 'path') && if ((err_content2.error['.tag'] === 'path') &&
(err_content.error.path['.tag'] === 'not_found')) { (err_content2.error.path['.tag'] === 'not_found')) {
throw new jIO.util.jIOError("Cannot find attachment: " + throw new jIO.util.jIOError("Cannot find attachment: " +
id + "/, " + name, 404); id + "/, " + name, 404);
} }
......
...@@ -70,12 +70,12 @@ ...@@ -70,12 +70,12 @@
expect(2); expect(2);
stop(); stop();
var test = this; var that = this;
this.jio.put("put1", {"title": "myPut1"}) this.jio.put("put1", {"title": "myPut1"})
.then(function (uuid) { .then(function (uuid) {
equal(uuid, "put1"); equal(uuid, "put1");
deepEqual(test.jio.__storage._database.put1, { deepEqual(that.jio.__storage._database.put1, {
attachments: {}, attachments: {},
doc: "{\"title\":\"myPut1\"}" doc: "{\"title\":\"myPut1\"}"
}); });
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
test("put when document already exists", function () { test("put when document already exists", function () {
var id = "put1", var id = "put1",
test = this; that = this;
this.jio.__storage._database[id] = { this.jio.__storage._database[id] = {
"foo": "bar", "foo": "bar",
"attachments": {"foo": "bar"}, "attachments": {"foo": "bar"},
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
this.jio.put(id, {"title": "myPut2"}) this.jio.put(id, {"title": "myPut2"})
.then(function (uuid) { .then(function (uuid) {
equal(uuid, "put1"); equal(uuid, "put1");
deepEqual(test.jio.__storage._database.put1, { deepEqual(that.jio.__storage._database.put1, {
"foo": "bar", "foo": "bar",
"attachments": {"foo": "bar"}, "attachments": {"foo": "bar"},
doc: "{\"title\":\"myPut2\"}" doc: "{\"title\":\"myPut2\"}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment