mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-05-16 21:00:35 +00:00
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>
This commit is contained in:
+7
-2
@@ -154,7 +154,12 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
|
||||
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<VideoRef, ReactVideoProps>(
|
||||
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):/,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user