mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-28 02:50:27 +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) {
|
||||
dat.writeFile(document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + document.location.pathname,text,"utf8").then(function(value) {
|
||||
callback(null);
|
||||
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);
|
||||
},function(reason) {
|
||||
callback("Beaker Saver Write Error: " + reason);
|
||||
});
|
||||
},function(reason) {
|
||||
callback("Beaker Saver Error: " + reason);
|
||||
callback("Beaker Saver Stat Error: " + reason);
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user