fix(xlsx): 修复 LuckyExcel 解析数据校验时 matchType 未映射导致的崩溃#730
Open
lanwood wants to merge 1 commit intokekingcn:masterfrom
Open
fix(xlsx): 修复 LuckyExcel 解析数据校验时 matchType 未映射导致的崩溃#730lanwood wants to merge 1 commit intokekingcn:masterfrom
lanwood wants to merge 1 commit intokekingcn:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
在 Excel(xlsx)在线预览使用
luckyexcel.umd.js解析时,部分工作表包含 数据有效性(dataValidation),且类型经DATA_VERIFICATION_MAP映射后得到的matchType(如dropdown、checkbox等)不在DATA_VERIFICATION_TYPE2_MAP中。原实现直接执行:DATA_VERIFICATION_TYPE2_MAP[matchType][operator]当
DATA_VERIFICATION_TYPE2_MAP[matchType]为undefined时,再访问[operator](例如between)会抛出:现象:

堆栈:
LuckySheet.generateConfigDataValidations→new LuckySheet→LuckyFile.Parse。修复
在
generateConfigDataValidations中先取var _t2map = DATA_VERIFICATION_TYPE2_MAP[matchType],仅在_t2map存在且包含对应operator时使用映射值;否则与原先「无合法映射」时的行为一致,回退为"bw"(与原分支在operator为空时使用"bw"的语义对齐)。变更范围
server/src/main/resources/static/xlsx/luckyexcel.umd.js测试文件:
luckyexcel-datavalidation-bug.xlsx