Fix read-only pads

pull/1/head
yflory 5 years ago
parent ea65647d44
commit 0237bb2867

@ -288,9 +288,10 @@ define([
var newHref; var newHref;
nThen(function (w) { nThen(function (w) {
if (!parsed.hashData.key && parsed.hashData.channel) { if (!parsed.hashData.key && parsed.hashData.channel) {
var edit = parsed.hashData.mode === 'edit';
Cryptpad.getPadDataFromChannel({ Cryptpad.getPadDataFromChannel({
channel: parsed.hashData.channel, channel: parsed.hashData.channel,
edit: parsed.hashData.mode === 'edit', edit: edit,
file: parsed.hashData.type === 'file' file: parsed.hashData.type === 'file'
}, w(function (err, res) { }, w(function (err, res) {
// Error while getting data? abort // Error while getting data? abort
@ -304,7 +305,7 @@ define([
return void noPadData('NO_RESULT'); return void noPadData('NO_RESULT');
} }
// Data found but weaker? warn // Data found but weaker? warn
if (parsed.hashData.mode === 'edit' && !res.href) { if (edit && !res.href) {
return void badPadData(w(function (load) { return void badPadData(w(function (load) {
if (!load) { if (!load) {
w.abort(); w.abort();
@ -314,7 +315,7 @@ define([
})); }));
} }
// We have good data, keep the hash in memory // We have good data, keep the hash in memory
newHref = res.href; newHref = edit ? res.href : (res.roHref || res.href);
})); }));
} }
}).nThen(function (w) { }).nThen(function (w) {

Loading…
Cancel
Save