Skip to content

Commit e89fbe6

Browse files
committed
fix: guard against empty path in NewFileReader after filepath.Clean
filepath.Clean("") returns "." which opens current directory instead of failing. Add explicit empty-path check before file operations.
1 parent 504e77d commit e89fbe6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/serializer/reader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ func NewFileReader(format Format, filePath string) (*Reader, error) {
147147
return nil, errors.New(errors.ErrCodeInvalidRequest, "table format does not support deserialization")
148148
}
149149

150+
if filePath == "" {
151+
return nil, errors.New(errors.ErrCodeInvalidRequest, "failed to open file: path is empty")
152+
}
153+
150154
// If the filePath is a URL or special scheme, handle accordingly
151155
var file *os.File
152156
var err error

0 commit comments

Comments
 (0)