Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Web client getFileContent implementation

Borislav Sapundzhiev2899902369cc
diff --git a/data/web/web.api.js b/data/web/web.api.js
index 2071cf4ac..3166ccf32 100644
--- a/data/web/web.api.js
+++ b/data/web/web.api.js
@@ -288,15 +288,18 @@ define(function(require, exports, module) {
var getFileContent = function(filePath, result, error) {
console.log("getFileContent file: " + filePath);
- davClient.get(
- encodeURI(filePath),
- function(status, data, headers) {
- //TODO: complete
- console.log("status: " + status);
- result(data);
+
+ var ajax = davClient.getAjax("GET", filePath);
+ ajax.onreadystatechange = null;
+ ajax.onload = function() {
+ if(ajax.response.byteLength !== null) {
+ result(ajax.response);
+ } else {
+ error(ajax.responseText);
}
- //,customHeaders
- );
+ };
+ ajax.responseType= "arraybuffer";
+ ajax.send();
};
exports.focusWindow = focusWindow;