diff --git a/errors.go b/errors.go index c9d18cb39f502bed0ee9dc7f04c950086d6cc00f..64fc7116669638012ebe5ec87f7c4fc78eec59a7 100644 --- a/errors.go +++ b/errors.go @@ -109,9 +109,9 @@ var ( // ErrWorkbookExt defined the error message on receive an 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. - 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 = errors.New("not support encryption currently") // ErrUnknownEncryptMechanism defined the error message on unsupported diff --git a/excelize_test.go b/excelize_test.go index 389573e2962448636ce52293419f91091c6def68..27badc6c629a914df5e01db60781e3df541e7609 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -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.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()) } diff --git a/file.go b/file.go index 9707a7939cd42d70481c2b1f871a39c87357a537..1d3360e13d9075708c802afc5beb9acae2a23771 100644 --- a/file.go +++ b/file.go @@ -66,8 +66,8 @@ func (f *File) Save() error { // SaveAs provides a function to create or update to a spreadsheet at the // provided path. func (f *File) SaveAs(name string, opt ...Options) error { - if len(name) > MaxFileNameLength { - return ErrMaxFileNameLength + if len(name) > MaxFilePathLength { + return ErrMaxFilePathLength } f.Path = name contentType, ok := map[string]string{ diff --git a/xmlDrawing.go b/xmlDrawing.go index 0b6df05f878a1914ec43f10270e093faf79ba24f..db5d7500354966476469e2fe716434b721cc2f28 100644 --- a/xmlDrawing.go +++ b/xmlDrawing.go @@ -103,7 +103,7 @@ const ( StreamChunkSize = 1 << 24 MaxFontFamilyLength = 31 MaxFontSize = 409 - MaxFileNameLength = 207 + MaxFilePathLength = 207 MaxFieldLength = 255 MaxColumnWidth = 255 MaxRowHeight = 409