Commit c62c5971 authored by Tristan Cavelier's avatar Tristan Cavelier

davstorage getAttachment doesn't return content type - fixed

parent 98a8e162
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
*/ */
/*jslint indent: 2, maxlen: 80, nomen: true, regexp: true, unparam: true */ /*jslint indent: 2, maxlen: 80, nomen: true, regexp: true, unparam: true */
/*global define, window, jIO, promy, btoa, DOMParser */ /*global define, window, jIO, promy, btoa, DOMParser, Blob */
// JIO Dav Storage Description : // JIO Dav Storage Description :
// { // {
...@@ -609,6 +609,7 @@ ...@@ -609,6 +609,7 @@
}}; }};
} }
delete o["Not Found"]; delete o["Not Found"];
o.type = attachment.content_type || "application/octet-stream";
o.notify_message = "Retrieving attachment"; o.notify_message = "Retrieving attachment";
o.percentage = [30, 100]; o.percentage = [30, 100];
o.digest = attachment.digest; o.digest = attachment.digest;
...@@ -616,7 +617,7 @@ ...@@ -616,7 +617,7 @@
}.bind(this), }.bind(this),
success: function (e) { success: function (e) {
command.success(e.target.status, { command.success(e.target.status, {
"data": e.target.response, "data": new Blob([e.target.response], {"type": o.type}),
"digest": o.digest "digest": o.digest
}); });
}, },
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* X-Requested-With, X-HTTP-Method-Override, Accept, Authorization, * X-Requested-With, X-HTTP-Method-Override, Accept, Authorization,
* Depth" * Depth"
*/ */
test("Scenario", 29, function () { test("Scenario", 31, function () {
ok(!(/^file:/.test(location.href)), ok(!(/^file:/.test(location.href)),
"Should not work on file protocol: " + location.href); "Should not work on file protocol: " + location.href);
...@@ -322,6 +322,7 @@ ...@@ -322,6 +322,7 @@
"statusText": "Ok" "statusText": "Ok"
}, "Get first attachment"); }, "Get first attachment");
return jIO.util.readBlobAsText(blob).then(function (e) { return jIO.util.readBlobAsText(blob).then(function (e) {
deepEqual(blob.type, "text/plain", "Check blob type");
deepEqual(e.target.result, "aab", "Check blob text content"); deepEqual(e.target.result, "aab", "Check blob text content");
}, function (err) { }, function (err) {
deepEqual(err, "no error", "Check blob text content"); deepEqual(err, "no error", "Check blob text content");
...@@ -347,6 +348,7 @@ ...@@ -347,6 +348,7 @@
"statusText": "Ok" "statusText": "Ok"
}, "Get first attachment"); }, "Get first attachment");
return jIO.util.readBlobAsText(blob).then(function (e) { return jIO.util.readBlobAsText(blob).then(function (e) {
deepEqual(blob.type, "text/plain", "Check blob type");
deepEqual(e.target.result, "aba", "Check blob text content"); deepEqual(e.target.result, "aba", "Check blob text content");
}, function (err) { }, function (err) {
deepEqual(err, "no error", "Check blob text content"); deepEqual(err, "no error", "Check blob text content");
......
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