Skip to content

fix: guard against empty BaseUrl to prevent file:// scheme error (#10)#127

Open
Amalie-Wowern wants to merge 3 commits into
main-v17from
fix/issue-10-activecampaign-file-scheme-error
Open

fix: guard against empty BaseUrl to prevent file:// scheme error (#10)#127
Amalie-Wowern wants to merge 3 commits into
main-v17from
fix/issue-10-activecampaign-file-scheme-error

Conversation

@Amalie-Wowern

Copy link
Copy Markdown

Fixes umbraco/Umbraco.Integrations.Issues#10

Root cause: When BaseUrl is not configured in appsettings, $"{baseUrl}/api/3/" evaluates to "/api/3/". new Uri("/api/3/") resolves against the process working directory, producing a file:// scheme URL. LoggingHttpMessageHandler then throws NotSupportedException: The 'file' scheme is not supported.

Fix: Read BaseUrl into a local variable and wrap the BaseAddress + Api-Token setup in a !string.IsNullOrWhiteSpace(baseUrl) guard. The HTTP client is still registered when unconfigured — calls will fail at request time with a clearer relative-URI error rather than crashing during DI initialization.

Files changed:

  • src/Umbraco.Forms.Integrations.Crm.ActiveCampaign/ActiveCampaignComposer.cs

When BaseUrl is not configured in appsettings, the URI resolves to
file:// which throws NotSupportedException in LoggingHttpMessageHandler.
Guard with IsNullOrWhiteSpace check before setting BaseAddress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants