Pull request: filtering: fix filter delete

Merge in DNS/adguard-home from 5700-fix-filter-delete to master

Squashed commit of the following:

commit 51e5c82bf6c12b48b1c07622639216ecba21e115
Merge: b4f8abdf2 37e046acc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Jun 22 17:05:23 2023 +0400

    Merge remote-tracking branch 'origin/master' into 5700-fix-filter-delete

commit b4f8abdf2e9a8c94594cb0e3b00b37e0ed49578a
Merge: eac30a13f f40ef76c7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Jun 22 16:55:58 2023 +0400

    Merge remote-tracking branch 'origin/master' into 5700-fix-filter-delete

commit eac30a13fb30404b2e058d1889be566d359d5000
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Jun 22 14:03:07 2023 +0400

    filtering: imp code

commit 4e270789b83bdcff09d94ace46dd0b02d2c6893c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Jun 22 14:02:04 2023 +0400

    all: docs

commit b818468ae29f647bcc0f4e408d10c8469829da95
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Jun 22 13:18:12 2023 +0400

    filtering: fix filter delete
This commit is contained in:
Dimitry Kolyshev 2023-06-22 16:09:55 +03:00
parent 37e046acc4
commit 66345e855e
2 changed files with 3 additions and 1 deletions

View file

@ -82,6 +82,7 @@ In this release, the schema version has changed from 20 to 21.
### Fixed ### Fixed
- The blocklists can now be deleted properly ([#5700]).
- Queries with the question-section target `.`, for example `NS .`, are now - Queries with the question-section target `.`, for example `NS .`, are now
counted in the statistics and correctly shown in the query log ([#5910]). counted in the statistics and correctly shown in the query log ([#5910]).
- Safe Search not working with `AAAA` queries for domains that don't have `AAAA` - Safe Search not working with `AAAA` queries for domains that don't have `AAAA`
@ -89,6 +90,7 @@ In this release, the schema version has changed from 20 to 21.
[#951]: https://github.com/AdguardTeam/AdGuardHome/issues/951 [#951]: https://github.com/AdguardTeam/AdGuardHome/issues/951
[#1577]: https://github.com/AdguardTeam/AdGuardHome/issues/1577 [#1577]: https://github.com/AdguardTeam/AdGuardHome/issues/1577
[#5700]: https://github.com/AdguardTeam/AdGuardHome/issues/5700
[#5910]: https://github.com/AdguardTeam/AdGuardHome/issues/5910 [#5910]: https://github.com/AdguardTeam/AdGuardHome/issues/5910
[#5913]: https://github.com/AdguardTeam/AdGuardHome/issues/5913 [#5913]: https://github.com/AdguardTeam/AdGuardHome/issues/5913

View file

@ -169,7 +169,7 @@ func (d *DNSFilter) handleFilteringRemoveURL(w http.ResponseWriter, r *http.Requ
deleted = (*filters)[delIdx] deleted = (*filters)[delIdx]
p := deleted.Path(d.DataDir) p := deleted.Path(d.DataDir)
err = os.Rename(p, p+".old") err = os.Rename(p, p+".old")
if err != nil { if err != nil && !errors.Is(err, os.ErrNotExist) {
log.Error("deleting filter %d: renaming file %q: %s", deleted.ID, p, err) log.Error("deleting filter %d: renaming file %q: %s", deleted.ID, p, err)
return return