Skip to content

Commit 016d8a1

Browse files
committed
fix: correctly handle literal file paths containing brackets
- Updated argument parsing in [GPTBatch.py](cci:7://file:///e:/Small-Scripts/Programming/GPTBatch.py:0:0-0:0) to check `os.path.isfile(p)` before applying `glob.glob`. - This prevents filenames with square brackets (e.g., "[MXS46LPdL5c]") from being misinterpreted as glob patterns. - Preserves existing wildcard support while ensuring explicit file names are processed reliably.
1 parent 7c6c310 commit 016d8a1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Programming/GPTBatch.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,13 @@ def main():
16311631

16321632
fps = []
16331633
if args.files:
1634-
for p in args.files: fps.extend(glob.glob(p, recursive=True))
1634+
for p in args.files:
1635+
# Check if it's a literal file path first (handles special chars like brackets)
1636+
if os.path.isfile(p):
1637+
fps.append(p)
1638+
else:
1639+
# Fall back to glob expansion for wildcards
1640+
fps.extend(glob.glob(p, recursive=True))
16351641
else:
16361642
console_log("No files specified. Scanning current directory for supported formats...", "INFO")
16371643
cwd = os.getcwd()

0 commit comments

Comments
 (0)