diff --git a/src/jio.storage/davstorage.js b/src/jio.storage/davstorage.js index 4dcae47c7d4d549239fdac427f7c4ddeb486c8c6..42cbaabbef1e73517986df04d3a0fbc089124484 100644 --- a/src/jio.storage/davstorage.js +++ b/src/jio.storage/davstorage.js @@ -5,7 +5,7 @@ */ /*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 : // { @@ -609,6 +609,7 @@ }}; } delete o["Not Found"]; + o.type = attachment.content_type || "application/octet-stream"; o.notify_message = "Retrieving attachment"; o.percentage = [30, 100]; o.digest = attachment.digest; @@ -616,7 +617,7 @@ }.bind(this), success: function (e) { command.success(e.target.status, { - "data": e.target.response, + "data": new Blob([e.target.response], {"type": o.type}), "digest": o.digest }); }, diff --git a/test/jio.storage/davstorage.livetests.js b/test/jio.storage/davstorage.livetests.js index e93c89d3d8a03a58861ca4efb6d9c0110d415316..c267c5d2045fc3f47f88b6a18665b0357ea66c18 100644 --- a/test/jio.storage/davstorage.livetests.js +++ b/test/jio.storage/davstorage.livetests.js @@ -45,7 +45,7 @@ * X-Requested-With, X-HTTP-Method-Override, Accept, Authorization, * Depth" */ - test("Scenario", 29, function () { + test("Scenario", 31, function () { ok(!(/^file:/.test(location.href)), "Should not work on file protocol: " + location.href); @@ -322,6 +322,7 @@ "statusText": "Ok" }, "Get first attachment"); 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"); }, function (err) { deepEqual(err, "no error", "Check blob text content"); @@ -347,6 +348,7 @@ "statusText": "Ok" }, "Get first attachment"); 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"); }, function (err) { deepEqual(err, "no error", "Check blob text content");