diff options
author | xuri <xuri.me@gmail.com> | 2020-05-29 00:26:40 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2020-05-29 00:26:40 +0800 |
commit | 2ae631376b95ff0a59ea18c2c0befcd50135b020 (patch) | |
tree | c3542c127aed38cac104c513047327d6316b91d1 /file.go | |
parent | c168233e70db8f220bd07d9d6d277ae9e2a4a73f (diff) |
add limits for total columns, row and filename length
Diffstat (limited to 'file.go')
-rw-r--r-- | file.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -12,6 +12,7 @@ package excelize import ( "archive/zip" "bytes" + "errors" "fmt" "io" "os" @@ -62,6 +63,9 @@ func (f *File) Save() error { // SaveAs provides a function to create or update to an xlsx file at the // provided path. func (f *File) SaveAs(name string) error { + if len(name) > FileNameLength { + return errors.New("file name length exceeds maximum limit") + } file, err := os.OpenFile(name, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0666) if err != nil { return err |