guard against trying to parse special fragments
This commit is contained in:
@@ -168,21 +168,25 @@ define([
|
|||||||
};
|
};
|
||||||
var getHashFromKeys = common.getHashFromKeys = getEditHashFromKeys;
|
var getHashFromKeys = common.getHashFromKeys = getEditHashFromKeys;
|
||||||
|
|
||||||
|
var specialHashes = common.specialHashes = ['iframe'];
|
||||||
var getSecrets = common.getSecrets = function (secretHash) {
|
var getSecrets = common.getSecrets = function (secretHash) {
|
||||||
var secret = {};
|
var secret = {};
|
||||||
|
var generate = function () {
|
||||||
|
secret.keys = Crypto.createEditCryptor();
|
||||||
|
secret.key = Crypto.createEditCryptor().editKeyStr;
|
||||||
|
};
|
||||||
if (/#\?path=/.test(window.location.href)) {
|
if (/#\?path=/.test(window.location.href)) {
|
||||||
var arr = window.location.hash.match(/\?path=(.+)/);
|
var arr = window.location.hash.match(/\?path=(.+)/);
|
||||||
common.initialPath = arr[1] || undefined;
|
common.initialPath = arr[1] || undefined;
|
||||||
window.location.hash = '';
|
window.location.hash = '';
|
||||||
}
|
}
|
||||||
if (!secretHash && !/#/.test(window.location.href)) {
|
if (!secretHash && !/#/.test(window.location.href)) {
|
||||||
secret.keys = Crypto.createEditCryptor();
|
generate();
|
||||||
secret.key = Crypto.createEditCryptor().editKeyStr;
|
return secret;
|
||||||
} else {
|
} else {
|
||||||
var hash = secretHash || window.location.hash.slice(1);
|
var hash = secretHash || window.location.hash.slice(1);
|
||||||
if (hash.length === 0) {
|
if (hash.length === 0 || specialHashes.indexOf(hash) !== -1) {
|
||||||
secret.keys = Crypto.createEditCryptor();
|
generate();
|
||||||
secret.key = Crypto.createEditCryptor().editKeyStr;
|
|
||||||
return secret;
|
return secret;
|
||||||
}
|
}
|
||||||
// old hash system : #{hexChanKey}{cryptKey}
|
// old hash system : #{hexChanKey}{cryptKey}
|
||||||
|
|||||||
Reference in New Issue
Block a user