diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 4790afcf4d..68a450e913 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1249,23 +1249,26 @@ var nameSpan=$('').addClass('nametext'); var innernameSpan = $('').addClass('innernametext').text(basename); - if (path && path !== '/') { - var conflictingItems = this.$fileList.find('tr[data-file="' + this._jqSelEscape(name) + '"]'); - if (conflictingItems.length !== 0) { - if (conflictingItems.length === 1) { - // Update the path on the first conflicting item - var $firstConflict = $(conflictingItems[0]), - firstConflictPath = $firstConflict.attr('data-path') + '/'; - if (firstConflictPath.charAt(0) === '/') { - firstConflictPath = firstConflictPath.substr(1); - } + + var conflictingItems = this.$fileList.find('tr[data-file="' + this._jqSelEscape(name) + '"]'); + if (conflictingItems.length !== 0) { + if (conflictingItems.length === 1) { + // Update the path on the first conflicting item + var $firstConflict = $(conflictingItems[0]), + firstConflictPath = $firstConflict.attr('data-path') + '/'; + if (firstConflictPath.charAt(0) === '/') { + firstConflictPath = firstConflictPath.substr(1); + } + if (firstConflictPath && firstConflictPath !== '/') { $firstConflict.find('td.filename span.innernametext').prepend($('').addClass('conflict-path').text(firstConflictPath)); } + } - var conflictPath = path + '/'; - if (conflictPath.charAt(0) === '/') { - conflictPath = conflictPath.substr(1); - } + var conflictPath = path + '/'; + if (conflictPath.charAt(0) === '/') { + conflictPath = conflictPath.substr(1); + } + if (path && path !== '/') { nameSpan.append($('').addClass('conflict-path').text(conflictPath)); } }