Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utils/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ export async function getModelFile(path_or_repo_id, filename, fatal = true, opti
});

if (result) {
if (return_path) {
if (!apis.IS_NODE_ENV && return_path) {
throw new Error("Cannot return path in a browser environment.")
}
return result;
Expand All @@ -647,7 +647,7 @@ export async function getModelFile(path_or_repo_id, filename, fatal = true, opti
return response.filePath;
}

const path = await cache.match(cacheKey);
const path = await cache?.match(cacheKey);
if (path instanceof FileResponse) {
return path.filePath;
}
Expand Down