Repository navigation
fix: keep Cloudflare record comment and tags when updating the IP - #324
Merged
TimothyYe merged 1 commit intoOct 23, 2026
Merged
Conversation
updateRecord sent the record with PUT, which Cloudflare documents as "Overwrite DNS Record": the record is replaced by the request body, so every IP update wiped the comment and tags set on the record (TimothyYe#323). Send the same body with PATCH ("Update DNS Record"), which only changes the fields that are sent. The verify test mock now records PATCH as the update call, and TestUpdateUsesPatch covers the issue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks a lot! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #323.
Bug
When the IP changes, the Cloudflare provider updates the record with
PUT /zones/{zone_id}/dns_records/{dns_record_id}. Cloudflare documents that call as Overwrite DNS Record: the request body replaces the whole record. GoDNS only sendsid,content,name,proxied,type,zone_idandttl, so every IP update removed the comment and tags set on the record in the dashboard. #323 reports the lost comment.Cloudflare's Manage DNS records page says to use PATCH to update part of a record, and PUT only to overwrite the entire record.
Fix
updateRecordnow sends the same body withPATCHon the same path (Update DNS Record), which only changes the fields in the body. In Cloudflare's OpenAPI schema, PUT and PATCH accept the same record fields and need the same token permission (DNS Write), so existing configs and tokens keep working.A comment set in the dashboard now survives IP updates. Setting the comment from the GoDNS config, which #323 also suggests, would be a separate feature and is not part of this change.
Tests
cloudflare_verify_test.gonow countsPATCHas the update call. With PUT,TestDedupMultipleStaleRecordsandTestRootDomainDedupwould fail.TestUpdateUsesPatchtests the Cloudflare: update will delete comment #323 case.I could not compile or run the Go tests locally because there is no Go toolchain in my environment, so CI will be the first real run. Instead, I checked the change against a Python re-implementation of the provider and of this mock. With PUT, the three tests above fail. With PATCH, all six tests in the file pass.
🤖 Generated with Claude Code