mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 15:19:06 +00:00
update
This commit is contained in:
@@ -881,14 +881,15 @@ export const Utils = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
pathNormalize: function(originalPath) {
|
pathNormalize: function(originalPath) {
|
||||||
let newPath = originalPath.split('/');
|
let oldPath = originalPath.split('/');
|
||||||
for (let i = 0; i < newPath.length; i++) {
|
let newPath = [];
|
||||||
if (newPath[i] === '.' || newPath[i] === '') {
|
for (let i = 0; i < oldPath.length; i++) {
|
||||||
newPath.splice(i, 1);
|
if (oldPath[i] === '.' || oldPath[i] === '') {
|
||||||
i--;
|
continue;
|
||||||
} else if (newPath[i] === '..') {
|
} else if (oldPath[i] === '..') {
|
||||||
newPath.splice(i - 1, 2);
|
newPath.pop();
|
||||||
i = i - 2;
|
} else {
|
||||||
|
newPath.push(oldPath[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newPath.join('/');
|
return newPath.join('/');
|
||||||
|
Reference in New Issue
Block a user