From a849cc19e8dafe0cc8147aeb8a226fc1373bb84d Mon Sep 17 00:00:00 2001 From: Vijay Bindraban <2269400+VMBindraban@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:18:34 +0200 Subject: [PATCH] fix: add extra checks to determine if a file is local (#4503) * fix: beter isLocalAsset checks * fix: add "asset://" to possible assets paths * Update src/Video.tsx --------- Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> --- src/Video.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Video.tsx b/src/Video.tsx index 09de1742..bf4824d7 100644 --- a/src/Video.tsx +++ b/src/Video.tsx @@ -154,7 +154,12 @@ const Video = forwardRef( const isLocalAssetFile = typeof _source === 'number' || - ('uri' in _source && typeof _source.uri === 'number'); + ('uri' in _source && typeof _source.uri === 'number') || + ('uri' in _source && + typeof _source.uri === 'string' && + (_source.uri.startsWith('file://') || + _source.uri.startsWith('content://') || + _source.uri.startsWith('.'))); const resolvedSource = resolveAssetSourceForVideo(_source); let uri = resolvedSource.uri || ''; @@ -168,7 +173,7 @@ const Video = forwardRef( const isAsset = !!( uri && uri.match( - /^(assets-library|ipod-library|file|content|ms-appx|ms-appdata):/, + /^(assets-library|ipod-library|file|content|ms-appx|ms-appdata|asset):/, ) );