未验证 提交 be5a4033 编写于 作者: S sceneq 提交者: GitHub

This closes #1229, rename ErrMaxFileNameLength to ErrMaxFilePathLength (#1230)

Co-authored-by: sceneq
上级 19a0cf3c
...@@ -109,9 +109,9 @@ var ( ...@@ -109,9 +109,9 @@ var (
// ErrWorkbookExt defined the error message on receive an unsupported // ErrWorkbookExt defined the error message on receive an unsupported
// workbook extension. // workbook extension.
ErrWorkbookExt = errors.New("unsupported workbook extension") ErrWorkbookExt = errors.New("unsupported workbook extension")
// ErrMaxFileNameLength defined the error message on receive the file name // ErrMaxFilePathLength defined the error message on receive the file path
// length overflow. // length overflow.
ErrMaxFileNameLength = errors.New("file name length exceeds maximum limit") ErrMaxFilePathLength = errors.New("file path length exceeds maximum limit")
// ErrEncrypt defined the error message on encryption spreadsheet. // ErrEncrypt defined the error message on encryption spreadsheet.
ErrEncrypt = errors.New("not support encryption currently") ErrEncrypt = errors.New("not support encryption currently")
// ErrUnknownEncryptMechanism defined the error message on unsupported // ErrUnknownEncryptMechanism defined the error message on unsupported
......
...@@ -170,7 +170,7 @@ func TestOpenFile(t *testing.T) { ...@@ -170,7 +170,7 @@ func TestOpenFile(t *testing.T) {
assert.NoError(t, f.SetCellStr("Sheet2", "c"+strconv.Itoa(i), strconv.Itoa(i))) assert.NoError(t, f.SetCellStr("Sheet2", "c"+strconv.Itoa(i), strconv.Itoa(i)))
} }
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestOpenFile.xlsx"))) assert.NoError(t, f.SaveAs(filepath.Join("test", "TestOpenFile.xlsx")))
assert.EqualError(t, f.SaveAs(filepath.Join("test", strings.Repeat("c", 199), ".xlsx")), ErrMaxFileNameLength.Error()) assert.EqualError(t, f.SaveAs(filepath.Join("test", strings.Repeat("c", 199), ".xlsx")), ErrMaxFilePathLength.Error())
assert.NoError(t, f.Close()) assert.NoError(t, f.Close())
} }
......
...@@ -66,8 +66,8 @@ func (f *File) Save() error { ...@@ -66,8 +66,8 @@ func (f *File) Save() error {
// SaveAs provides a function to create or update to a spreadsheet at the // SaveAs provides a function to create or update to a spreadsheet at the
// provided path. // provided path.
func (f *File) SaveAs(name string, opt ...Options) error { func (f *File) SaveAs(name string, opt ...Options) error {
if len(name) > MaxFileNameLength { if len(name) > MaxFilePathLength {
return ErrMaxFileNameLength return ErrMaxFilePathLength
} }
f.Path = name f.Path = name
contentType, ok := map[string]string{ contentType, ok := map[string]string{
......
...@@ -103,7 +103,7 @@ const ( ...@@ -103,7 +103,7 @@ const (
StreamChunkSize = 1 << 24 StreamChunkSize = 1 << 24
MaxFontFamilyLength = 31 MaxFontFamilyLength = 31
MaxFontSize = 409 MaxFontSize = 409
MaxFileNameLength = 207 MaxFilePathLength = 207
MaxFieldLength = 255 MaxFieldLength = 255
MaxColumnWidth = 255 MaxColumnWidth = 255
MaxRowHeight = 409 MaxRowHeight = 409
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册