Skip to content

Commit 151fbd0

Browse files
authored
[iOS] - Properly handle URL eliding when blobs are given. (uplift to 1.71.x) (#26096)
Uplift of #26085 (squashed) to release
1 parent f8f6d2c commit 151fbd0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ios/brave-ios/Sources/Brave/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift

+10-3
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,22 @@ class TabLocationView: UIView {
450450
}
451451

452452
private func updateURLBarWithText() {
453-
if let url = url, let internalURL = InternalURL(url), internalURL.isBasicAuthURL {
453+
guard let url = url else {
454+
urlDisplayLabel.text = ""
455+
return
456+
}
457+
458+
if let internalURL = InternalURL(url), internalURL.isBasicAuthURL {
454459
urlDisplayLabel.text = Strings.PageSecurityView.signIntoWebsiteURLBarTitle
455460
} else {
456461
// Matches LocationBarModelImpl::GetFormattedURL in Chromium (except for omitHTTP)
457462
// components/omnibox/browser/location_bar_model_impl.cc
458463
// TODO: Export omnibox related APIs and use directly
459464
urlDisplayLabel.text = URLFormatter.formatURL(
460-
url?.absoluteString ?? "",
461-
formatTypes: [.trimAfterHost, .omitHTTP, .omitHTTPS, .omitTrivialSubdomains],
465+
url.scheme == "blob" ? URLOrigin(url: url).url?.absoluteString ?? "" : url.absoluteString,
466+
formatTypes: [
467+
.trimAfterHost, .omitHTTP, .omitHTTPS, .omitTrivialSubdomains, .omitDefaults,
468+
],
462469
unescapeOptions: .normal
463470
)
464471
}

0 commit comments

Comments
 (0)