diff --git a/client/src/actions/index.js b/client/src/actions/index.js index efb2db12..015aecd1 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -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) { diff --git a/client/src/components/Filters/UserRules.js b/client/src/components/Filters/UserRules.js index bfd87b89..3d4b4275 100644 --- a/client/src/components/Filters/UserRules.js +++ b/client/src/components/Filters/UserRules.js @@ -20,7 +20,7 @@ export default class UserRules extends Component { subtitle="Enter one rule on a line. You can use either adblock rules or hosts files syntax." >
-