fix: remove all the slashes at the end
This commit is contained in:
@@ -41,11 +41,9 @@ const TargetForm: React.FC<TargetFormProps> = forwardRef((props, ref) => {
|
|||||||
|
|
||||||
const handleOnLocalPathBlur = (e: any) => {
|
const handleOnLocalPathBlur = (e: any) => {
|
||||||
let { value } = e.target;
|
let { value } = e.target;
|
||||||
// remove the last slash: windows or linux
|
|
||||||
const lastChar = value.slice(-1);
|
// remove all the backslashes and slashes at the end of the string
|
||||||
if (lastChar === '/' || lastChar === '\\') {
|
value = value.replace(/(\\|\/)+$/, '');
|
||||||
value = value.slice(0, -1);
|
|
||||||
}
|
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
local_path: value
|
local_path: value
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user