mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 06:04:15 +00:00
Fix asset resolver url handling
Summary: 1. file:// may get prepended to an http:// source URL during dev mode, making an invalid URL 2. the logic to detect `isLoadedFromFileSystem()` should've checked for file:// protocol to not get confused by http:// URL Reviewed By: zahanm Differential Revision: D6307187 fbshipit-source-id: e7e7a41bf721dd0601b0c1877e278e1e435ef5e2
This commit is contained in:
parent
266ab7a006
commit
28d5d6baf1
@ -73,7 +73,7 @@ class AssetSourceResolver {
|
||||
}
|
||||
|
||||
isLoadedFromFileSystem(): boolean {
|
||||
return !!this.jsbundleUrl;
|
||||
return !!(this.jsbundleUrl && this.jsbundleUrl.startsWith('file://'));
|
||||
}
|
||||
|
||||
canLoadFromEmbeddedBundledLocation(): boolean {
|
||||
|
@ -43,7 +43,7 @@ function _coerceLocalScriptURL(scriptURL: ?string): ?string {
|
||||
return null;
|
||||
}
|
||||
scriptURL = scriptURL.substring(0, scriptURL.lastIndexOf('/') + 1);
|
||||
if (!scriptURL.startsWith('file://')) {
|
||||
if (!scriptURL.includes('://')) {
|
||||
// Add file protocol in case we have an absolute file path and not a URL.
|
||||
// This shouldn't really be necessary. scriptURL should be a URL.
|
||||
scriptURL = 'file://' + scriptURL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user