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

This commit is contained in:
ansuz 2020-05-25 12:13:28 -04:00
commit acf8dc45f1
2 changed files with 23 additions and 12 deletions

View file

@ -197,17 +197,27 @@ define([
};
Thumb.fromBlob = function (blob, _cb) {
var cb = Util.once(_cb);
if (blob.type.indexOf('video/') !== -1) {
return void Thumb.fromVideoBlob(blob, cb);
}
if (blob.type.indexOf('application/pdf') !== -1) {
return void Thumb.fromPdfBlob(blob, cb);
}
if (Util.isPlainTextFile(blob.type, blob.name)) {
return void Thumb.fromPlainTextBlob(blob, cb);
}
if (blob.type.indexOf('image/') !== -1) {
return void Thumb.fromImageBlob(blob, cb);
// The blob is already in memory, it should be super-fast to make a thumbnail
// ==> 1s timeout
setTimeout(function () {
console.error("Thumbnail timeout");
cb('TIMEOUT');
}, 1000);
try {
if (blob.type.indexOf('video/') !== -1) {
return void Thumb.fromVideoBlob(blob, cb);
}
if (blob.type.indexOf('application/pdf') !== -1) {
return void Thumb.fromPdfBlob(blob, cb);
}
if (Util.isPlainTextFile(blob.type, blob.name)) {
return void Thumb.fromPlainTextBlob(blob, cb);
}
if (blob.type.indexOf('image/') !== -1) {
return void Thumb.fromImageBlob(blob, cb);
}
} catch (e) {
return void cb('THUMBNAIL_ERROR');
}
return void cb('NO_THUMBNAIL');
};

View file

@ -826,8 +826,9 @@ define([
if (!resolved.id) {
var el = Env.user.userObject.find(resolved.path);
if (Env.user.userObject.isSharedFolder(el) && Env.folders[el]) {
var oldName = Env.folders[el].proxy.metadata.title;
Env.folders[el].proxy.metadata.title = data.newName;
Env.user.proxy[UserObject.SHARED_FOLDERS][el].lastTitle = data.value;
Env.user.proxy[UserObject.SHARED_FOLDERS][el].lastTitle = oldName;
return void cb();
}
}