Skip to content

Commit 9ddaf7c

Browse files
Fix WebView error handling to enable mp3 attachments loading (#904)
1 parent 20d920b commit 9ddaf7c

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6-
### 🔄 Changed
6+
### 🐞 Fixed
7+
- Fix WebView error handling to enable mp3 attachments loading [#904](https://github.com/GetStream/stream-chat-swiftui/pull/904)
78

89
# [4.83.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.83.0)
910
_July 29, 2025_

Sources/StreamChatSwiftUI/ChatChannel/MessageList/WebView.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ struct WebView: UIViewRepresentable {
7171
didFailProvisionalNavigation navigation: WKNavigation!,
7272
withError error: Error
7373
) {
74+
if isPluginHandledLoadResult(error) {
75+
return
76+
}
77+
7478
isLoading.wrappedValue = false
7579
self.error.wrappedValue = error
7680
}
@@ -80,8 +84,17 @@ struct WebView: UIViewRepresentable {
8084
didFail navigation: WKNavigation!,
8185
withError error: Error
8286
) {
87+
if isPluginHandledLoadResult(error) {
88+
return
89+
}
90+
8391
isLoading.wrappedValue = false
8492
self.error.wrappedValue = error
8593
}
94+
95+
private func isPluginHandledLoadResult(_ error: Error) -> Bool {
96+
let nsError = error as NSError
97+
return nsError.domain == "WebKitErrorDomain" && nsError.code == 204
98+
}
8699
}
87100
}

0 commit comments

Comments
 (0)