Skip to content

Commit c84517c

Browse files
committed
fix: audio recordings working across devices
1 parent 7992186 commit c84517c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

package/src/middlewares/attachments.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ import {
1111
MiddlewareHandlerParams,
1212
} from 'stream-chat';
1313

14-
const localAttachmentToAttachment = (localAttachment: LocalAttachment) => {
14+
import { isLocalUrl } from '../utils/utils';
15+
16+
export const localAttachmentToAttachment = (localAttachment: LocalAttachment) => {
1517
const { localMetadata, ...attachment } = localAttachment;
1618

1719
if (isLocalImageAttachment(localAttachment)) {
18-
const isRemoteUri = !!attachment.image_url;
20+
const isRemoteUri = !!attachment.image_url && !isLocalUrl(attachment.image_url);
1921

2022
if (isRemoteUri) return attachment as Attachment;
2123

@@ -25,7 +27,7 @@ const localAttachmentToAttachment = (localAttachment: LocalAttachment) => {
2527
originalFile: localMetadata.file,
2628
} as Attachment;
2729
} else {
28-
const isRemoteUri = !!attachment.asset_url;
30+
const isRemoteUri = !!attachment.asset_url && !isLocalUrl(attachment.asset_url);
2931
if (isRemoteUri) return attachment as Attachment;
3032

3133
return {

0 commit comments

Comments
 (0)