Skip to content

Commit f3746eb

Browse files
committed
Fix WebView error handling to enable mp3 attachments loading
1 parent 20d920b commit f3746eb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ struct WebView: UIViewRepresentable {
7171
didFailProvisionalNavigation navigation: WKNavigation!,
7272
withError error: Error
7373
) {
74+
// Ignore "Plug-in handled load" error as it's actually success for audio files
75+
let nsError = error as NSError
76+
if nsError.domain == "WebKitErrorDomain" && nsError.code == 204 {
77+
return
78+
}
79+
7480
isLoading.wrappedValue = false
7581
self.error.wrappedValue = error
7682
}
@@ -80,6 +86,12 @@ struct WebView: UIViewRepresentable {
8086
didFail navigation: WKNavigation!,
8187
withError error: Error
8288
) {
89+
// Ignore "Plug-in handled load" error as it's actually success for audio files
90+
let nsError = error as NSError
91+
if nsError.domain == "WebKitErrorDomain" && nsError.code == 204 {
92+
return
93+
}
94+
8395
isLoading.wrappedValue = false
8496
self.error.wrappedValue = error
8597
}

0 commit comments

Comments
 (0)