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

Normalize the sheet name to fix behavior regression between 2.6.0 & 2.6.1 #1366

Merged

Conversation

jtwatson
Copy link
Contributor

@jtwatson jtwatson commented Oct 6, 2022

PR Details

Description

normalize the sheet name as is done elsewhere in the code:
sheet = trimSheetName(sheet)

Related Issue

Closes #1365

Motivation and Context

Fixing a behavior regression between 2.6.0 and 2.6.1

How Has This Been Tested

This simple code verifies that it fixes the issue.

package main

import (
	"fmt"

	"github.com/xuri/excelize/v2"
)

func main() {
	spreadsheet := excelize.NewFile()
	defer spreadsheet.Close()

	sheet := "My Sheet: 1"
	spreadsheet.NewSheet(sheet)

	row := []interface{}{"A1", "B1"}

	if err := spreadsheet.SetSheetRow(sheet, "A1", &row); err != nil {
		fmt.Println(err)
	}

	if err := spreadsheet.SaveAs("mytest.xlsx"); err != nil {
		fmt.Println(err)
	}
}

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@jtwatson jtwatson closed this Oct 6, 2022
@jtwatson jtwatson force-pushed the bug/invalid-sheet-name-handling-regression branch from bbdd0a3 to 53a4955 Compare October 6, 2022 01:46
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
@jtwatson jtwatson reopened this Oct 6, 2022
@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2022

Codecov Report

Merging #1366 (eec38e8) into master (53a4955) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1366   +/-   ##
=======================================
  Coverage   98.44%   98.44%           
=======================================
  Files          31       31           
  Lines       23434    23435    +1     
=======================================
+ Hits        23070    23071    +1     
  Misses        242      242           
  Partials      122      122           
Flag Coverage Δ
unittests 98.44% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sheet.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@xuri xuri added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 6, 2022
Copy link
Member

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution.

@xuri xuri merged commit 5705132 into qax-os:master Oct 7, 2022
xuri pushed a commit to carbin-gun/excelize that referenced this pull request Oct 9, 2022
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
KyKyPy3 pushed a commit to Infowatch/excelize that referenced this pull request Nov 16, 2022
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
xuri pushed a commit to JDavidVR/excelize that referenced this pull request Jul 11, 2023
Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this pull request 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
size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Behavior regression between 2.6.0 & 2.6.1 - Invalid sheet name is no longer normalized
3 participants