mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20: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) => {
|
||||
if (replacePrefix && path.startsWith(replacePrefix)) {
|
||||
return path.slice(replacePrefix.length);
|
||||
let newPath = path;
|
||||
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