stevejenkins / pihole-cloudsync

Syncs blocklists, blacklists, and whitelists across multiple Pi-holes using a private GitHub repo
MIT License
515 stars 105 forks source link

Adlist comment with quotemark breaks gravity update after pull #50

Open hartacus opened 7 months ago

hartacus commented 7 months ago

Adding a comment to an adlist that contains a quote mark or apostrophe, i.e. "Person's Blocklist", breaks the gravity update on the "pull" client after the database update.

After updating the database, the pull client attempts a gravity update and receives an error: [i] Creating new gravity databases... [✗] Unable to copy data from /etc/pihole/gravity.db to /etc/pihole/gravity.db_temp Runtime error near line 24: FOREIGN KEY constraint failed (19) [✗] Unable to create gravity database. Please try again later. If the problem persists, please contact support.

Removing the quote marks from blocklist comments on the "push" client allows the "pull" client to update gravity correctly after the next pull.

Examining the db_dump.sql file shows that the insert command attempts to escape the single quote by doubling it. This appears not to be handled well on the other end.