mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
Share plugin: decode the URI component before checking for the leading hash sign
Should compensate for the mangling we get from Discourse – see https://talk.tiddlywiki.org/t/revived-share-plugin/5887
This commit is contained in:
parent
02d28c100b
commit
c39ef398bf
@ -13,19 +13,17 @@ Read tiddlers from the browser location hash
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Get the hash
|
// Get the hash
|
||||||
var rawHash = document.location.hash.substring(1);
|
var hash;
|
||||||
if(rawHash.charAt(0) === "#") {
|
try {
|
||||||
var hash;
|
hash = decodeURIComponent(document.location.hash.substring(1));
|
||||||
try{
|
} catch(e) {
|
||||||
hash = decodeURIComponent(rawHash.substring(1));
|
}
|
||||||
} catch(ex) {
|
if(hash && hash.charAt(0) === "#") {
|
||||||
console.log("Share plugin: Error decoding location hash",ex);
|
|
||||||
}
|
|
||||||
// Try to parse the hash as JSON
|
// Try to parse the hash as JSON
|
||||||
if(hash) {
|
if(hash) {
|
||||||
var tiddlers;
|
var tiddlers;
|
||||||
try {
|
try {
|
||||||
tiddlers= JSON.parse(hash);
|
tiddlers= JSON.parse(hash.substr(1));
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
console.log("Share plugin: Error parsing JSON from location hash",ex);
|
console.log("Share plugin: Error parsing JSON from location hash",ex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user