Fix xlsx_errors column overwriting the last data column#2181
Closed
prajakta128 wants to merge 1 commit into
Closed
Fix xlsx_errors column overwriting the last data column#2181prajakta128 wants to merge 1 commit into
prajakta128 wants to merge 1 commit into
Conversation
errors_col_index was set to len(fields) - 1 which points to the last data column, not the xlsx_errors column. The xlsx_errors column is appended after all fields, so its correct index is len(fields). Add a regression test to verify the error message lands in the correct column and does not overwrite data. Fixes aboutcode-org#2088 Signed-off-by: Prajakta Kamble <prajuu2812@gmail.com>
cf09e4c to
fc66d11
Compare
Author
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.
What
Fix
xlsx_errorscolumn writing error messages to the wrong column, overwriting the last data column's value.Why
errors_col_index = len(fields) - 1points to the last data column (zero-indexed). Butxlsx_errorsis appended AFTER all fields, so its correct index islen(fields).For example with 3 fields [col_a, col_b, col_c]:
How to reproduce
Export any project to XLSX where a field value exceeds 32,767 chars. The truncation error message overwrites col_c instead of appearing in the xlsx_errors column.
Fix
One line changed in
scanpipe/pipes/output.py:errors_col_index = len(fields) - 1errors_col_index = len(fields)Added a regression test in
scanpipe/tests/pipes/test_output.py.Fixes #2088