From 887e9d978b1c0bc7e35dbf2de9a10258095ba9f4 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Mon, 5 May 2014 13:30:31 +0100 Subject: [PATCH] Fix problem with saving if URL contains # --- core/modules/savers/andtidwiki.js | 2 +- core/modules/savers/tiddlyfox.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/savers/andtidwiki.js b/core/modules/savers/andtidwiki.js index 53d11d7cf..584db5d62 100644 --- a/core/modules/savers/andtidwiki.js +++ b/core/modules/savers/andtidwiki.js @@ -17,7 +17,7 @@ var AndTidWiki = function(wiki) { AndTidWiki.prototype.save = function(text,method,callback) { // Get the pathname of this document - var pathname = decodeURIComponent(document.location.toString()); + var pathname = decodeURIComponent(document.location.toString().split("#")[0]); // Strip the file:// if(pathname.indexOf("file://") === 0) { pathname = pathname.substr(7); diff --git a/core/modules/savers/tiddlyfox.js b/core/modules/savers/tiddlyfox.js index dd885526e..542b61e40 100644 --- a/core/modules/savers/tiddlyfox.js +++ b/core/modules/savers/tiddlyfox.js @@ -19,7 +19,7 @@ TiddlyFoxSaver.prototype.save = function(text,method,callback) { var messageBox = document.getElementById("tiddlyfox-message-box"); if(messageBox) { // Get the pathname of this document - var pathname = document.location.toString(); + var pathname = document.location.toString().split("#")[0]; // Replace file://localhost/ with file:/// if(pathname.indexOf("file://localhost/") == 0) { pathname = "file://" + pathname.substr(16); @@ -43,6 +43,7 @@ TiddlyFoxSaver.prototype.save = function(text,method,callback) { } // Create the message element and put it in the message box var message = document.createElement("div"); +console.log("Pathname",pathname); message.setAttribute("data-tiddlyfox-path",decodeURIComponent(pathname)); message.setAttribute("data-tiddlyfox-content",text); messageBox.appendChild(message);