Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the way to merge config for find & replace string #207

Merged
merged 1 commit into from
Jun 27, 2019

Conversation

j0k3r
Copy link
Owner

@j0k3r j0k3r commented Jun 26, 2019

find_string & replace_string had special case when merging them.
But it failed when merging multiple times some site config.

Update it to a bit more complex solution to ensure find_string & replace_string aren't duplicated when merging config multiple times.

We can't perform an array_unique on these values (looks like fabrizio got the point years ago) mostly because replace_string can have same values, example:

find_string: <amp-img
replace_string: <img

find_string: <other-img
replace_string: <img

To fix that issue, we combine find & replace as key & value in one array, we merge them (so we can't have duplicates keys) and then rebuild find & replace string in the current config.

@fivefilters, you might be interested by applying that fix on FullTextRSS I think.

Fix wallabag/wallabag#4025

`find_string` & `replace_string` had special case when merging them.
But it failed when merging multiple times.

Update it to a bit more complex solution to ensure `find_string` & `replace_string` aren't duplicated when merging config multiple times.

We can't perform an `array_unique` on these values (looks like fabrizio got the point years ago) mostly because `replace_string` can have same values, example:

```
find_string: <amp-img
replace_string: <img

find_string: <other-img
replace_string: <img
```

To fix that issue, we combine find & replace as key & value in one array, we merge them (so we can't have duplicates keys) and then rebuild find & replace string in the current config
@j0k3r j0k3r force-pushed the fix-bad-merge-find-replace-string branch from 61b5586 to 9336ff5 Compare June 26, 2019 07:44
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 96.531% when pulling 9336ff5 on fix-bad-merge-find-replace-string into 36a0f61 on master.

@j0k3r j0k3r merged commit da49da0 into master Jun 27, 2019
@j0k3r j0k3r deleted the fix-bad-merge-find-replace-string branch June 27, 2019 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 millions duplicates replace_string & find_string in siteconfig
2 participants