mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-06-24 09:24:07 +00:00
Fix problem with beaker saver and default index pages
As discussed on the mailing list, we need to check for a URL that is missing the default `/index.html` https://groups.google.com/d/msg/tiddlywikidev/n6yUdu2zHWo/m32R2BuIDgAJ
This commit is contained in:
parent
eac449e8ff
commit
ab1b1f2cde
@ -20,10 +20,18 @@ var BeakerSaver = function(wiki) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
BeakerSaver.prototype.save = function(text,method,callback) {
|
BeakerSaver.prototype.save = function(text,method,callback) {
|
||||||
dat.writeFile(document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + document.location.pathname,text,"utf8").then(function(value) {
|
var url = (location.toString()).split("#")[0];
|
||||||
|
dat.stat(url).then(function(value) {
|
||||||
|
if(value.type === "directory") {
|
||||||
|
url = url + "/index.html";
|
||||||
|
}
|
||||||
|
dat.writeFile(url,text,"utf8").then(function(value) {
|
||||||
callback(null);
|
callback(null);
|
||||||
},function(reason) {
|
},function(reason) {
|
||||||
callback("Beaker Saver Error: " + reason);
|
callback("Beaker Saver Write Error: " + reason);
|
||||||
|
});
|
||||||
|
},function(reason) {
|
||||||
|
callback("Beaker Saver Stat Error: " + reason);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user