1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 06:43:15 +00:00
A couple of fixes:

* Fixed problem with loading saver in a file URI within Beaker
* Fixed problem when saving to a directory-style URI with an implicit
“/index.html”
* Switched to double quotes for strings
This commit is contained in:
Jermolene 2017-06-24 22:30:26 +01:00
parent ef9efbc399
commit a5e565e198

View File

@ -20,16 +20,14 @@ var BeakerSaver = function(wiki) {
this.wiki = wiki; this.wiki = wiki;
}; };
var dat = new DatArchive('' + window.location);
BeakerSaver.prototype.save = function(text,method,callback) { BeakerSaver.prototype.save = function(text,method,callback) {
var path = (location.pathname.toString()).split("#")[0]; var dat = new DatArchive("" + window.location),
pathname = ("" + window.location.pathname).split("#")[0];
dat.stat(path).then(function(value) { dat.stat(pathname).then(function(value) {
if(value.isDirectory) { if(value.isDirectory()) {
path = path + "/index.html"; pathname = pathname + "/index.html";
} }
dat.writeFile(path,text,"utf8").then(function(value) { dat.writeFile(pathname,text,"utf8").then(function(value) {
callback(null); callback(null);
},function(reason) { },function(reason) {
callback("Beaker Saver Write Error: " + reason); callback("Beaker Saver Write Error: " + reason);