fix: Handle existing branding localization for PhishProtection standard - #282
Open
ZenTopBrandon wants to merge 1 commit into
Open
fix: Handle existing branding localization for PhishProtection standard#282ZenTopBrandon wants to merge 1 commit into
ZenTopBrandon wants to merge 1 commit into
Conversation
Check for the default branding localization before creating it, and treat only the known object-conflict race as a recovered informational condition. Keep unexpected creation failures at error severity and cover the behavior with Pester tests.
Contributor
✅ PR title follows Conventional CommitsReceived: Thanks for fixing it! |
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.
Summary
Fixes misleading errors from the
PhishProtectionstandard when the tenant's default branding localization already exists but has no custom CSS.Previously, the standard used the response from
/branding/localizations/0/customCSSto infer whether the default localization existed. An existing localization with no custom CSS was therefore treated as missing, causing CIPP to attempt to create localization ID0again.Microsoft Graph correctly rejected that request with:
The standard subsequently applied the CSS successfully, but the recovered creation conflict remained in the Logbook at Error severity and could make the standard appear to have failed.
Changes
0.0is absent.Request_BadRequest/ObjectConflictresponse targetingidas a recovered race condition.Why retain conflict handling after the existence check?
The existence check prevents the normal duplicate-create case, but another process could create localization ID
0between the GET and POST requests.The targeted
ObjectConflicthandling covers that race without suppressing unrelated Graph failures.Tests
Added Pester coverage for:
0is absent.