Bug 169176 - BASIC: ScriptForge.IsFileName incorrectly rejects filenames with commas (",") in Windows
Summary: BASIC: ScriptForge.IsFileName incorrectly rejects filenames with commas (",")...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
25.8.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: ScriptForge
  Show dependency treegraph
 
Reported: 2025-10-31 18:17 UTC by Bill M
Modified: 2025-11-01 08:50 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill M 2025-10-31 18:17:14 UTC
Description:
I'm calling "FSO.GetBaseName(file)" after getting a list of files in a directory using "filesList = FSO.Files" and "For Each file In filesList".  When it gets to a file with a comma in the filename, it throws an error and exits the code.

Steps to Reproduce:
In LibreOffice BASIC:
1. First, create a file with a comma (",") in the filename in directory "DirName"
2. filesList = fs.Files(DirName, "*.*", IncludeSubfolders := False)
3. For Each file In filesList
4. TempName = fs.GetBaseName(file)
5. Next file

Actual Results:
LibreOffice BASIC will throw an error and exit the sub

Expected Results:
This shouldn't throw an error.  Commas are allowed in Windows filenames.


Reproducible: Always


User Profile Reset: No

Additional Info:
Tracked it down to a "Const" in the header of the SF_String module.  

I don't anything about Regular Expressions, but I imagine the comma needs to be removed from:
  Const REGEXFILEWIN="^([A-Z]|[a-z]:)?[^<>:;,?""*|]+$"
making it:
  Const REGEXFILEWIN="^([A-Z]|[a-z]:)?[^<>:;?""*|]+$"

BTW:  I'm new to LibreOffice.  I'm also NOT a programmer (just insanely curious about things), but I do use VBA once in a while.  

I would also like to write back filenames with commas, so is there any way I can fix this myself, instead of waiting for some future release?  I mean, I can see the problem, but I don't know how to access it to fix it!
Comment 1 Werner Tietz 2025-11-01 08:50:43 UTC
its simple enough with pure python instead BASIC & SF!

```
from pathlib import Path

def test_filelist(*_):
    directory = Path.home() / "Documents" #for example
    for p in directory.glob("*.*"):
        print(p.name)
```