[Bugfix] Unquote file uri before reading image (#22912)

Signed-off-by: Sayandip Dutta <sayandip199309@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
This commit is contained in:
Sayandip Dutta
2025-08-15 09:28:00 +00:00
committed by GitHub
co-authored by Cyrus Leung
parent fe91ce9591
commit aa300c438d
2 changed files with 28 additions and 1 deletions
+2 -1
View File
@@ -9,6 +9,7 @@ from itertools import groupby
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union
from urllib.parse import ParseResult, urlparse
from urllib.request import url2pathname
import numpy as np
import numpy.typing as npt
@@ -108,7 +109,7 @@ class MediaConnector:
raise RuntimeError("Cannot load local files without "
"`--allowed-local-media-path`.")
filepath = Path(url_spec.path)
filepath = Path(url2pathname(url_spec.path))
if allowed_local_media_path not in filepath.resolve().parents:
raise ValueError(
f"The file path {filepath} must be a subpath "