fix: harden BBCode link interactions#77
Merged
everpcpc merged 2 commits intobangumi:mainfrom Apr 11, 2026
Merged
Conversation
Avoid applying link attributes to attachment ranges so BBCode text does not enter the UIKit drag path with malformed link metadata. Route BBCode link taps through the host openURL handler, adopt the iOS 17 primaryAction text item delegate, disable text drag on read-only text blocks, and remove the obsolete WKProcessPool configuration. Add a regression test covering URL rendering around attachments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The BBCode UIKit renderer could crash when a read-only text view contained both rich links and attachments, because link metadata was being applied across attachment ranges and the view could enter the system text-drag path. In the same area, BBCode links were bypassing the app routing layer and opening directly in the browser.
Approach
Limit link attributes to non-attachment text ranges, disable text drag on read-only BBCode text blocks, and move link handling to the iOS 17 text item primary action delegate. The SwiftUI host now injects
openURLinto the UIKit renderer so BBCode links follow the existing in-app URL handling path instead of jumping straight to Safari.Scope
WKProcessPoolconfiguration from the inline web viewCURRENT_PROJECT_VERSIONto 114Validation
xcodebuild build -scheme Bangumi -project /Users/everpcpc/src/Bangumi-iOS/Bangumi.xcodeproj -destination 'platform=iOS Simulator,id=75F620AF-2C66-40F2-BCED-3096C45EE02D' CODE_SIGNING_ALLOWED=NOxcodebuild test -scheme BBCode ...is still blocked by the scheme not being configured for the test action in this project setup