Replace line endings on save
This commit is contained in:
parent
c40f7b4d5c
commit
e20bfe9d08
@ -293,7 +293,10 @@ export const setRulesSuccess = createAction('SET_RULES_SUCCESS');
|
||||
export const setRules = rules => async (dispatch) => {
|
||||
dispatch(setRulesRequest());
|
||||
try {
|
||||
await apiClient.setRules(rules);
|
||||
const replacedLineEndings = rules
|
||||
.replace(/^\n/g, '')
|
||||
.replace(/\n\s*\n/g, '\n');
|
||||
await apiClient.setRules(replacedLineEndings);
|
||||
dispatch(addSuccessToast('Custom rules saved'));
|
||||
dispatch(setRulesSuccess());
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user