Skip to content

fix: Set empty host for itms-services URL in SentryDistribution updater#8567

Open
chenj-hub wants to merge 1 commit into
getsentry:mainfrom
chenj-hub:jackies/2026-07-24-fix-sentry-distribution-updater-itms-url
Open

fix: Set empty host for itms-services URL in SentryDistribution updater#8567
chenj-hub wants to merge 1 commit into
getsentry:mainfrom
chenj-hub:jackies/2026-07-24-fix-sentry-distribution-updater-itms-url

Conversation

@chenj-hub

Copy link
Copy Markdown

📜 Description

Explicitly set components.host = "" when constructing itms-services URLs. This ensures URLComponents generates the correct URL format with an empty host component.

💡 Motivation and Context

The buildUrlForInstall() method in SentryDistribution.Updater was generating malformed itms-services URLs. Without explicitly setting the host component, URLComponents produces URLs that don't work with iOS enterprise app distribution.

The itms-services scheme requires the format:

itms-services://?action=download-manifest&url=...

But without setting host = "", the generated URL was malformed.

💚 How did you test it?

Manual verification: itms-services URLs now generate in the correct format

$ swift -e '
  import Foundation

  let plistUrl = "https://example.com/manifest.plist"

  // WITHOUT the fix (buggy behavior)
  var componentsWithoutFix = URLComponents()
  componentsWithoutFix.scheme = "itms-services"
  // componentsWithoutFix.host = ""  // <- missing this line
  componentsWithoutFix.queryItems = [
    URLQueryItem(name: "action", value: "download-manifest"),
    URLQueryItem(name: "url", value: plistUrl)
  ]
  print("WITHOUT fix:")
  print(componentsWithoutFix.url?.absoluteString ?? "nil")
  print()

  // WITH the fix (correct behavior)
  var componentsWithFix = URLComponents()
  componentsWithFix.scheme = "itms-services"
  componentsWithFix.host = ""  // <- this is the fix
  componentsWithFix.queryItems = [
    URLQueryItem(name: "action", value: "download-manifest"),
    URLQueryItem(name: "url", value: plistUrl)
  ]
  print("WITH fix:")
  print(componentsWithFix.url?.absoluteString ?? "nil")
  '
WITHOUT fix:
itms-services:?action=download-manifest&url=https://example.com/manifest.plist

WITH fix:
itms-services://?action=download-manifest&url=https://example.com/manifest.plist

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.

1 participant