summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-12-21 20:15:15 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-12-21 21:49:10 +0100
commitbc74a44cbc7ce5b80e66d5b68eb32b50d1357950 (patch)
tree80083004db2cbdc0451cacf0d10ebde0d3856300
parent4566670fa38c64fff020fe012e2bd33254f55b07 (diff)
downloadnextcloud-server-bc74a44cbc7ce5b80e66d5b68eb32b50d1357950.tar.gz
nextcloud-server-bc74a44cbc7ce5b80e66d5b68eb32b50d1357950.zip
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>
-rw-r--r--apps/comments/js/search.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/comments/js/search.js b/apps/comments/js/search.js
index 11a96594580..8e0a35ff6ed 100644
--- a/apps/comments/js/search.js
+++ b/apps/comments/js/search.js
@@ -92,7 +92,9 @@
.css('background-image', 'url(' + OC.imagePath('core', 'actions/comment') + ')')
.css('opacity', '.4');
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 = '/';
}
$row.find('td.info a').attr('href',