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!
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) ```
Ooops ... I was not aware of this bug report. Sorry for that. I confirm the bug, change its status to NEW and assign it to myself. The correction is exactly what you wrote: Const REGEXFILELINUX = "^[^<>:;,?""*|\\]+$" in SF_String must not contain any comma (and also any semicolon). To workaround the bug before fixing it in a next release, IMO you have two options: 1. Work with fs.FileNaming = "URL" The issue happens only when FileNaming is set to "SYS". 2. Edit the SF_String.xba file by yourself. Remember however that it will be overwritten at each LO update. So, better avoid it. I keep you informed of fixes.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/1952c85f9ca8846e149016f54846342b74985ee8 ScriptForge fix tdf#169176 comma in file names It will be available in 26.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "libreoffice-26-2": https://git.libreoffice.org/core/commit/e94e19bf2e19c17ac96c8c387baec3e16e0d8b83 ScriptForge fix tdf#169176 comma in file names It will be available in 26.2.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.