Skip to content

MOBILE-258: Allow path prefix for operaionsDomain#741

Open
enotniy wants to merge 1 commit into
developfrom
feature/MOBILE-258
Open

MOBILE-258: Allow path prefix for operaionsDomain#741
enotniy wants to merge 1 commit into
developfrom
feature/MOBILE-258

Conversation

@enotniy

@enotniy enotniy commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for specifying operationsDomain with an optional path prefix (e.g. domain.com/api/v2) so operations endpoints are appended after that prefix, enabling deployments behind reverse proxies/anonymizers.

Changes:

  • Extend validation to accept host/path-prefix for operationsDomain (while keeping domain host-only).
  • Update URL building to append route paths to any existing base-path prefix.
  • Add unit tests covering routing, configuration validation, and config policy normalization/rejection rules for path prefixes.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Mindbox/Network/Helpers/URLRequestBuilder.swift Appends route.path onto any base URL path prefix when building requests.
Mindbox/Network/Helpers/HostNormalizer.swift Documents support for optional path prefixes in normalized host inputs.
Mindbox/Validators/URLValidator.swift Adds isValidHostWithOptionalPath for validating operationsDomain with an optional path prefix.
Mindbox/MBConfiguration.swift Allows operationsDomain values that include a path prefix; keeps domain validation host-only.
Mindbox/InAppMessages/Configuration/Services/OperationsDomainConfigPolicy.swift Updates config policy validation to accept path-prefix forms and keep canonical storage behavior.
MindboxTests/Network/OperationsURLRoutingTests.swift Adds routing tests ensuring path prefixes are preserved and concatenated correctly.
MindboxTests/Configuration/MBConfigurationTests.swift Adds configuration tests for acceptance/rejection of path-prefix operationsDomain values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Mindbox/Validators/URLValidator.swift
@github-actions

Copy link
Copy Markdown
Contributor
TestsPassed ✅SkippedFailedTime ⏱
Unit tests report1344 ran1344 ✅1m 46s 974ms

@Vailence Vailence left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пофиксить бы один комментарий, и можно мержить

/// Path-prefix rule for `isValidHostWithOptionalPath`: zero or more non-empty
/// segments of unreserved URL characters. Query, fragment and empty segments
/// do not match.
private static let pathPrefixPattern = "^(?:/[A-Za-z0-9._~%-]+)*$"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pathPrefixPattern разрешает % как обычный символ, не проверяя, что это валидный percent-escape. В итоге domain.com/a%zz проходит валидацию в MBConfiguration.init без ошибки, а падает уже в рантайме: URLComponents(string:) возвращает nil → badURL на каждом запросе

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.

3 participants