Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior regression between 2.6.0 & 2.6.1 - Invalid sheet name is no longer normalized #1365

Closed
jtwatson opened this issue Oct 6, 2022 · 0 comments · Fixed by #1366
Closed
Labels
bug Something isn't working

Comments

@jtwatson
Copy link
Contributor

jtwatson commented Oct 6, 2022

Description

In v2.6.0, a sheet name would be normalized so that if it contains an invalid character or was > 31 characters, the name was modified to remove invalid characters and shorten the name.

You could do something like this:

	sheet := "My Sheet: 1" // notice the invalid ':' character
	spreadsheet.NewSheet(sheet)

	spreadsheet.SetSheetRow(sheet, "A1", []string{"bla", "bla", "bla")

In v2.6.0 this produced a sheet name My Sheet 1 // Notice the ':' has been removed
In v2.6.1 this produces an error: sheet My Sheet: 1 is not exist

The issue was introduced here

getSheetXMLPath() does not preserve the same behavior as the previous code

name, ok := f.sheetMap[trimSheetName(sheet)]

getSheetXMLPath() should use trimSheetName() to restore previous behavior

Output of go version:

$ go version
go version go1.19.1 linux/amd64

Excelize version or commit ID:

github.com/xuri/excelize/v2@v2.6.1

Environment details (OS, Microsoft Excel™ version, physical, etc.):
Fedora release 36 (Thirty Six)

@xuri xuri added the bug Something isn't working label Oct 6, 2022
@xuri xuri closed this as completed in #1366 Oct 7, 2022
xuri pushed a commit that referenced this issue Oct 7, 2022
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
xuri pushed a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
KyKyPy3 pushed a commit to Infowatch/excelize that referenced this issue Nov 16, 2022
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
xuri pushed a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants