Replace line endings on save

This commit is contained in:
Ildar Kamalov 2018-09-28 17:47:34 +03:00
parent c40f7b4d5c
commit e20bfe9d08
1 changed files with 4 additions and 1 deletions

View File

@ -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) {