fix: remove all the slashes at the end

This commit is contained in:
jialin
2025-05-08 20:36:34 +08:00
parent 92b4be90d0
commit 53b51f0740
+3 -5
View File
@@ -41,11 +41,9 @@ const TargetForm: React.FC<TargetFormProps> = 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
});