Make sure we can't open a pad using the wrong app

This commit is contained in:
yflory
2017-09-19 11:31:45 +02:00
parent 35a313d6ee
commit 72f0952835
3 changed files with 9 additions and 7 deletions

View File

@@ -378,7 +378,6 @@ define([
};
config.onReady = function (info) {
console.log('onready');
if (APP.realtime !== info.realtime) {
var realtime = APP.realtime = info.realtime;
APP.patchText = TextPatcher.create({
@@ -400,7 +399,8 @@ define([
metadataMgr.updateMetadata(hjson.metadata);
}
if (typeof (hjson) !== 'object' || Array.isArray(hjson) ||
(typeof(hjson.type) !== 'undefined' && hjson.type !== 'code')) {
(hjson.metadata && typeof(hjson.metadata.type) !== 'undefined' &&
hjson.metadata.type !== 'code')) {
var errorText = Messages.typeError;
Cryptpad.errorLoadingScreen(errorText);
throw new Error(errorText);