From b1ddafffb0acb47a2d8f37cc1d3d4be2634d8fb3 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Wed, 16 Apr 2025 10:55:32 -0700 Subject: [PATCH] fix: `RawImage.fromURL` error when input file url --- src/utils/hub.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/hub.js b/src/utils/hub.js index ab67ea8e6..814b7d53d 100755 --- a/src/utils/hub.js +++ b/src/utils/hub.js @@ -215,8 +215,7 @@ function isValidHfModelId(string) { export async function getFile(urlOrPath) { if (env.useFS && !isValidUrl(urlOrPath, ['http:', 'https:', 'blob:'])) { - return new FileResponse(urlOrPath.toString()); - + return new FileResponse(urlOrPath instanceof URL ? urlOrPath.pathname : urlOrPath); } else if (typeof process !== 'undefined' && process?.release?.name === 'node') { const IS_CI = !!process.env?.TESTING_REMOTELY; const version = env.version;