Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
yflory
2017-05-11 12:43:49 +02:00
7 changed files with 327 additions and 194 deletions

View File

@@ -66,6 +66,10 @@ define([
return '/' + parsed.type + '/#' + parsed.hash;
};
var fixDuplicateSlashes = function (s) {
return s.replace(/\/+/g, '/');
};
/*
* Returns all needed keys for a realtime channel
* - no argument: use the URL hash or create one if it doesn't exist
@@ -95,7 +99,7 @@ define([
}
else {
// New hash
var hashArray = hash.split('/');
var hashArray = fixDuplicateSlashes(hash).split('/');
if (hashArray.length < 4) {
Hash.alert("Unable to parse the key");
throw new Error("Unable to parse the key");
@@ -179,7 +183,7 @@ Version 2
parsed.version = 0;
return parsed;
}
var hashArr = hash.split('/');
var hashArr = fixDuplicateSlashes(hash).split('/');
if (hashArr[1] && hashArr[1] === '1') {
parsed.version = 1;
parsed.mode = hashArr[2];