Skip to content

Commit

Permalink
[iOS] - Properly handle URL eliding when blobs are given. (uplift to …
Browse files Browse the repository at this point in the history
…1.71.x) (#26096)

Uplift of #26085 (squashed) to release
  • Loading branch information
brave-builds authored Oct 21, 2024
1 parent f8f6d2c commit 151fbd0
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,22 @@ class TabLocationView: UIView {
}

private func updateURLBarWithText() {
if let url = url, let internalURL = InternalURL(url), internalURL.isBasicAuthURL {
guard let url = url else {
urlDisplayLabel.text = ""
return
}

if let internalURL = InternalURL(url), internalURL.isBasicAuthURL {
urlDisplayLabel.text = Strings.PageSecurityView.signIntoWebsiteURLBarTitle
} else {
// Matches LocationBarModelImpl::GetFormattedURL in Chromium (except for omitHTTP)
// components/omnibox/browser/location_bar_model_impl.cc
// TODO: Export omnibox related APIs and use directly
urlDisplayLabel.text = URLFormatter.formatURL(
url?.absoluteString ?? "",
formatTypes: [.trimAfterHost, .omitHTTP, .omitHTTPS, .omitTrivialSubdomains],
url.scheme == "blob" ? URLOrigin(url: url).url?.absoluteString ?? "" : url.absoluteString,
formatTypes: [
.trimAfterHost, .omitHTTP, .omitHTTPS, .omitTrivialSubdomains, .omitDefaults,
],
unescapeOptions: .normal
)
}
Expand Down

0 comments on commit 151fbd0

Please # to comment.