Skip to content

Commit

Permalink
Fix brave/brave-ios#8667: Fix webcompat url for internal links (brave…
Browse files Browse the repository at this point in the history
  • Loading branch information
cuba authored Feb 5, 2024
1 parent 00105e4 commit 59c4397
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,11 @@ extension BrowserViewController: TopToolbarDelegate {

shields.showSubmitReportView = { [weak self] shieldsViewController in
shieldsViewController.dismiss(animated: true) {
guard let url = shieldsViewController.tab.url else { return }
self?.showSubmitReportView(for: url)
if let internalURL = InternalURL(url), let displayURL = internalURL.displayURL {
self?.showSubmitReportView(for: displayURL)
} else {
self?.showSubmitReportView(for: url)
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions Sources/Shared/Extensions/URLExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -638,4 +638,13 @@ public struct InternalURL {
}
return nil
}

public var displayURL: URL? {
if isErrorPage {
return originalURLFromErrorPage
} else if isReaderModePage {
return extractedUrlParam
}
return nil
}
}

0 comments on commit 59c4397

Please sign in to comment.