From 0237bb2867a056d1686f4f9c5993a53688bea6f2 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 28 Jan 2020 10:46:26 +0100 Subject: [PATCH] Fix read-only pads --- www/common/sframe-common-outer.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index ad67db8ec..0197d68ee 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -288,9 +288,10 @@ define([ var newHref; nThen(function (w) { if (!parsed.hashData.key && parsed.hashData.channel) { + var edit = parsed.hashData.mode === 'edit'; Cryptpad.getPadDataFromChannel({ channel: parsed.hashData.channel, - edit: parsed.hashData.mode === 'edit', + edit: edit, file: parsed.hashData.type === 'file' }, w(function (err, res) { // Error while getting data? abort @@ -304,7 +305,7 @@ define([ return void noPadData('NO_RESULT'); } // Data found but weaker? warn - if (parsed.hashData.mode === 'edit' && !res.href) { + if (edit && !res.href) { return void badPadData(w(function (load) { if (!load) { w.abort(); @@ -314,7 +315,7 @@ define([ })); } // We have good data, keep the hash in memory - newHref = res.href; + newHref = edit ? res.href : (res.roHref || res.href); })); } }).nThen(function (w) {