From 035d5dced28a2180da1e27eb011c508eb3ff408c Mon Sep 17 00:00:00 2001 From: Saul Pwanson Date: Sun, 13 Oct 2024 15:08:26 -0700 Subject: [PATCH] [xls] fail on non-local file #2557 --- visidata/loaders/xlsx.py | 2 ++ visidata/path.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/visidata/loaders/xlsx.py b/visidata/loaders/xlsx.py index 834035d06..8fc462588 100644 --- a/visidata/loaders/xlsx.py +++ b/visidata/loaders/xlsx.py @@ -14,10 +14,12 @@ @VisiData.api def open_xls(vd, p): + p.is_local() or vd.fail('xls loader does not support remote files') return XlsIndexSheet(p.base_stem, source=p) @VisiData.api def open_xlsx(vd, p): + p.is_local() or vd.fail('xlsx loader does not support remote files') return XlsxIndexSheet(p.base_stem, source=p) class XlsxIndexSheet(IndexSheet): diff --git a/visidata/path.py b/visidata/path.py index d272b8aa7..d5564b622 100644 --- a/visidata/path.py +++ b/visidata/path.py @@ -361,7 +361,7 @@ def is_fifo(self): def is_local(self): 'Return True if self.filename refers to a file on the local disk.' - return not bool(self.fp) and not bool(self.fptext) + return not bool(self.is_url()) and not bool(self.fp) and not bool(self.fptext) def is_url(self): 'Return True if the given path appears to be a URL.'