[PR #90] [MERGED] fix subdomain edit and improved error handling #106

Closed
opened 2026-05-07 00:18:07 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/pelican-dev/plugins/pull/90
Author: @TinyMemoria
Created: 1/26/2026
Status: Merged
Merged: 1/26/2026
Merged by: @Boy132

Base: mainHead: main


📝 Commits (3)

  • d0b827e fix subdomain edit and improved error handling
  • a584e79 changed variable to camelCase and response handling
  • 10ac7c5 cleanup

📊 Changes

2 files changed (+46 additions, -25 deletions)

View changed files

📝 subdomains/src/Models/Subdomain.php (+33 -22)
📝 subdomains/src/Services/SubdomainService.php (+13 -3)

📄 Description

Fixes: #87

Fixed the Edit workflow so that editing a subdomain updates Cloudflare correctly and does not delete the record on failure (some improved error handling).

Previous:
When you edit a subdomain name, the plugin calls Cloudflare in a way that incorrectly treats the existing record as a conflict. Throws exception, and deletes record.

Now:
When you edit a subdomain name, the plugin queries Cloudflare records by name and type, then checks each record ID, if record has a different ID, an exception is thrown, otherwise update the record.

Additional error handling:
If New Subdomain is created for the first time and there is an error, delete the record (as previous).
If Subdomain is being edited and there is an error, keep the record, as to not remove a current working record.

Summary by CodeRabbit

  • Bug Fixes

    • Added preflight validation to detect duplicate or conflicting DNS records earlier.
    • Unified record name handling (including SRV records) to ensure consistent creation and updates.
    • Ensured payload is validated against server allocation IPs for non-SRV records.
  • Refactor

    • Made create/update flow explicit with safer cleanup and state refresh to avoid deleting existing records on errors.

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/pelican-dev/plugins/pull/90 **Author:** [@TinyMemoria](https://github.com/TinyMemoria) **Created:** 1/26/2026 **Status:** ✅ Merged **Merged:** 1/26/2026 **Merged by:** [@Boy132](https://github.com/Boy132) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`d0b827e`](https://github.com/pelican-dev/plugins/commit/d0b827e79e2bf5846b75e8fe323a887473572ee2) fix subdomain edit and improved error handling - [`a584e79`](https://github.com/pelican-dev/plugins/commit/a584e79ced99ac58d4eb4a58080999303e09e1c1) changed variable to camelCase and response handling - [`10ac7c5`](https://github.com/pelican-dev/plugins/commit/10ac7c56b4ed6513ba7dad49313896078f2c0d93) cleanup ### 📊 Changes **2 files changed** (+46 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `subdomains/src/Models/Subdomain.php` (+33 -22) 📝 `subdomains/src/Services/SubdomainService.php` (+13 -3) </details> ### 📄 Description Fixes: #87 Fixed the Edit workflow so that editing a subdomain updates Cloudflare correctly and does not delete the record on failure (some improved error handling). **Previous:** When you edit a subdomain name, the plugin calls Cloudflare in a way that incorrectly treats the existing record as a conflict. Throws exception, and deletes record. **Now:** When you edit a subdomain name, the plugin queries Cloudflare records by name and type, then checks each record ID, if record has a different ID, an exception is thrown, otherwise update the record. Additional error handling: If New Subdomain is created for the first time and there is an error, delete the record (as previous). If Subdomain is being edited and there is an error, keep the record, as to not remove a current working record. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Added preflight validation to detect duplicate or conflicting DNS records earlier. * Unified record name handling (including SRV records) to ensure consistent creation and updates. * Ensured payload is validated against server allocation IPs for non-SRV records. * **Refactor** * Made create/update flow explicit with safer cleanup and state refresh to avoid deleting existing records on errors. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:18:07 +02:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/plugins#106
No description provided.