mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-06 20:10:12 +02:00
fix file path replacement to handle both add/replace (#1749)
This commit is contained in:
@@ -565,9 +565,10 @@ export const sortRadioList = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const replacePathPrefix = (path: string, replacePrefix?: string, addPrefix?: string) => {
|
export const replacePathPrefix = (path: string, replacePrefix?: string, addPrefix?: string) => {
|
||||||
if (replacePrefix && path.startsWith(replacePrefix)) {
|
let newPath = path;
|
||||||
return path.slice(replacePrefix.length);
|
if (replacePrefix && newPath.startsWith(replacePrefix)) {
|
||||||
|
newPath = newPath.slice(replacePrefix.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
return addPrefix ? addPrefix + path : path;
|
return addPrefix ? addPrefix + newPath : newPath;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user