Skip the prefetcher when the URL scheme isn't fetchable.
Drag-and-drop uploads go through Module.loadFile and never reached the prefetcher. This is a guard for future provider schemes (e.g., vfs) that shouldn't be passed to fetch(). PiperOrigin-RevId: 926042158 Change-Id: I119d5b1a7512f8e84bb4c752414797593a1e98cd
This commit is contained in:
committed by
Copybara-Service
parent
45d5f2ed5f
commit
0897e3aec1
@@ -50,6 +50,14 @@ function resolveScheme(url) {
|
||||
}
|
||||
|
||||
async function prefetchModelAssets(rootUrl, onProgress) {
|
||||
// Only prefetch when the root URL is one we know how to fetch from
|
||||
// Javascript. Other resource-provider-backed schemes (e.g., uploaded files
|
||||
// via the drag-and-drop path) skip the prefetcher entirely and let
|
||||
// Module.loadUrl handle take the existing slow path.
|
||||
if (!/^(https?:|github:)/.test(rootUrl)) {
|
||||
return { files: 0, bytes: 0, errors: 0 };
|
||||
}
|
||||
|
||||
const primed = new Set(); // URLs we've already pushed into FetchCache
|
||||
const stats = { files: 0, bytes: 0, errors: 0 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user