Skip to content

Commit be5a403

Browse files
authored
This closes qax-os#1229, rename ErrMaxFileNameLength to ErrMaxFilePathLength (qax-os#1230)
Co-authored-by: sceneq
1 parent 19a0cf3 commit be5a403

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

errors.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ var (
109109
// ErrWorkbookExt defined the error message on receive an unsupported
110110
// workbook extension.
111111
ErrWorkbookExt = errors.New("unsupported workbook extension")
112-
// ErrMaxFileNameLength defined the error message on receive the file name
112+
// ErrMaxFilePathLength defined the error message on receive the file path
113113
// length overflow.
114-
ErrMaxFileNameLength = errors.New("file name length exceeds maximum limit")
114+
ErrMaxFilePathLength = errors.New("file path length exceeds maximum limit")
115115
// ErrEncrypt defined the error message on encryption spreadsheet.
116116
ErrEncrypt = errors.New("not support encryption currently")
117117
// ErrUnknownEncryptMechanism defined the error message on unsupported

excelize_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func TestOpenFile(t *testing.T) {
170170
assert.NoError(t, f.SetCellStr("Sheet2", "c"+strconv.Itoa(i), strconv.Itoa(i)))
171171
}
172172
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestOpenFile.xlsx")))
173-
assert.EqualError(t, f.SaveAs(filepath.Join("test", strings.Repeat("c", 199), ".xlsx")), ErrMaxFileNameLength.Error())
173+
assert.EqualError(t, f.SaveAs(filepath.Join("test", strings.Repeat("c", 199), ".xlsx")), ErrMaxFilePathLength.Error())
174174
assert.NoError(t, f.Close())
175175
}
176176

file.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ func (f *File) Save() error {
6666
// SaveAs provides a function to create or update to a spreadsheet at the
6767
// provided path.
6868
func (f *File) SaveAs(name string, opt ...Options) error {
69-
if len(name) > MaxFileNameLength {
70-
return ErrMaxFileNameLength
69+
if len(name) > MaxFilePathLength {
70+
return ErrMaxFilePathLength
7171
}
7272
f.Path = name
7373
contentType, ok := map[string]string{

xmlDrawing.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const (
103103
StreamChunkSize = 1 << 24
104104
MaxFontFamilyLength = 31
105105
MaxFontSize = 409
106-
MaxFileNameLength = 207
106+
MaxFilePathLength = 207
107107
MaxFieldLength = 255
108108
MaxColumnWidth = 255
109109
MaxRowHeight = 409

0 commit comments

Comments
 (0)