mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
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:
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user