Fix opening search results for comments

"OC.dirname" removes everything after the last "/", so a path without
slashes is returned without changes. "result.path" does not include
leading nor trailing "/", so when the path is for a file or folder in
the base folder "OC.dirname(result.path)" returns "result.path".

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2018-12-21 20:15:15 +01:00
parent 4566670fa3
commit bc74a44cbc
1 changed files with 3 additions and 1 deletions

View File

@ -92,7 +92,9 @@
.css('background-image', 'url(' + OC.imagePath('core', 'actions/comment') + ')') .css('background-image', 'url(' + OC.imagePath('core', 'actions/comment') + ')')
.css('opacity', '.4'); .css('opacity', '.4');
var dir = OC.dirname(result.path); var dir = OC.dirname(result.path);
if (dir === '') { // "result.path" does not include a leading "/", so "OC.dirname"
// returns the path itself for files or folders in the root.
if (dir === result.path) {
dir = '/'; dir = '/';
} }
$row.find('td.info a').attr('href', $row.find('td.info a').attr('href',