mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-03-14 22:48:35 +03:00
Replace line endings on save
This commit is contained in:
parent
c40f7b4d5c
commit
e20bfe9d08
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue