From 7e0a2abc2c459a6f173bf04eb915381477f86691 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 14 Jun 2017 13:03:10 +0200 Subject: [PATCH] Fix the file name when restoring an element from the trash --- www/drive/main.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/www/drive/main.js b/www/drive/main.js index 3d9c04ad3..b93086262 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -2389,8 +2389,7 @@ define([ var name = paths[0].path[paths[0].path.length - 1]; if ($(this).hasClass("remove")) { if (paths.length === 1) { - if (path.length === 4) { name = path[1]; } - Cryptpad.confirm(Messages._getKey("fm_removePermanentlyDialog", [name]), function(res) { + Cryptpad.confirm(Messages.fm_removePermanentlyDialog, function(res) { if (!res) { return; } filesOp.delete([path], refresh); }); @@ -2406,7 +2405,14 @@ define([ } else if ($(this).hasClass("restore")) { if (paths.length !== 1) { return; } - if (path.length === 4) { name = path[1]; } + if (path.length === 4) { + var el = filesOp.find(path); + if (filesOp.isFile(el)) { + name = filesOp.getTitle(el); + } else { + name = path[1]; + } + } Cryptpad.confirm(Messages._getKey("fm_restoreDialog", [name]), function(res) { if (!res) { return; } filesOp.restore(path, refresh);