diff --git a/src/utils/index.js b/src/utils/index.js index 082e818f2..7e3b811cd 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,27 +1,12 @@ function convertPathToHtml(path) { - let count = 0 + let htmlpath = '' while (path.startsWith('../')) { - count++ path = path.slice(3) + if (htmlpath.length < 2) htmlpath += '.' + else htmlpath += '/..' } - if (count === 1) { - return '.' - } - - if (count === 2) { - return '..' - } - - if (count === 3) { - return '../..' - } - - if (count === 4) { - return '../../..' - } - - return '' + return htmlpath } export { convertPathToHtml }