diff --git a/src/pages/llmodels/download/target-form.tsx b/src/pages/llmodels/download/target-form.tsx index f8ae9ae3..f4b21ddf 100644 --- a/src/pages/llmodels/download/target-form.tsx +++ b/src/pages/llmodels/download/target-form.tsx @@ -41,11 +41,9 @@ const TargetForm: React.FC = forwardRef((props, ref) => { const handleOnLocalPathBlur = (e: any) => { let { value } = e.target; - // remove the last slash: windows or linux - const lastChar = value.slice(-1); - if (lastChar === '/' || lastChar === '\\') { - value = value.slice(0, -1); - } + + // remove all the backslashes and slashes at the end of the string + value = value.replace(/(\\|\/)+$/, ''); form.setFieldsValue({ local_path: value });