skip format check for filenames ending with dot

also add a unit test for func FormatStringFromFilename to cover such case
This commit is contained in:
ryenus
2025-07-15 19:30:07 +10:00
committed by Mike Farah
parent 6e8cc00030
commit d0c897f5e6
2 changed files with 37 additions and 1 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ func FormatStringFromFilename(filename string) string {
if filename != "" {
GetLogger().Debugf("checking filename '%s' for auto format detection", filename)
ext := filepath.Ext(filename)
if ext != "" && ext[0] == '.' {
if len(ext) >= 2 && ext[0] == '.' {
format := strings.ToLower(ext[1:])
GetLogger().Debugf("detected format '%s'", format)
return format