From 5dd1972f96b655bac16dbd58b5ea3c46debbdbca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Thu, 9 Jan 2025 01:20:59 +0000 Subject: [PATCH] logreader: support filesystem DATA_ENDPOINT (#34340) * Check if DATA_ENDPOINT is a dir * Change url resolution to support joining dirs --- tools/lib/filereader.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/lib/filereader.py b/tools/lib/filereader.py index 8206ad22286d7e..0bb4abd2fa56f9 100644 --- a/tools/lib/filereader.py +++ b/tools/lib/filereader.py @@ -1,4 +1,5 @@ import os +import posixpath import socket from urllib.parse import urlparse @@ -8,6 +9,9 @@ def internal_source_available(url=DATA_ENDPOINT): + if os.path.isdir(url): + return True + try: hostname = urlparse(url).hostname port = urlparse(url).port or 80 @@ -22,7 +26,7 @@ def internal_source_available(url=DATA_ENDPOINT): def resolve_name(fn): if fn.startswith("cd:/"): - return fn.replace("cd:/", DATA_ENDPOINT) + return posixpath.join(DATA_ENDPOINT, fn[4:]) return fn