Repository navigation
Fix BOM export losing link text and mangling numeric-looking values - #580
Merged
Merged
Conversation
saveBomTable read only the first child node of marks and links, so a link whose text starts with a filter highlight exported as "null" and other highlighted links were truncated. Use textContent instead. CSV export also emitted any numeric-looking value as a bare number, turning part codes like 0805, 0x10 or 1e3 into 805, 16 and 1000. Only emit a bare number when that is lossless, and escape double quotes in header names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes three problems in
saveBomTable(web/util.js), used by the CSV, TXT (TSV) and copy-to-clipboard exports.Link/highlight text lost
For
<mark>and<a>nodes the export read onlynode.firstChild.nodeValue. A link whose text starts with a filter highlight is<a><mark>https</mark>://…</a>, so its first child is an element and the cell exported asnull. If the highlight was elsewhere in the link, only the text before it was exported. Cells now usenode.textContent, which also covers marks nested inside links. Checkbox inputs are handled as before.Numeric-looking values converted in CSV
Any value passing
isNumericwas written as a bare number, so part codes such as0805,0x10and1e3became805,16and1000in the file. A value is now written unquoted only ifString(+val) === val, i.e. converting it is lossless. Plain numbers like10,4.7and-3(and the row index/quantity columns) stay bare numbers.Unescaped quotes in CSV header
Header names were wrapped in quotes without escaping embedded
", so a checkbox or field name containing a quote produced a malformed header row. They are now escaped the same way as cell values.Testing
Generated a BOM from the KiCad Arduino_Uno template with
Datasheetshown, injected test values intopcbdata, and captured the blobs passed tosaveFile:https(CSV and TSV)"null"/null"https://example.com/ds0.pdf"0805(CSV)805"0805"0x10/1e3(CSV)16/1000"0x10"/"1e3"say "hi", checkbox namePl"aced"say ""hi""","Pl""aced"4.7,-3,10, ticked checkbox"✓"No console errors.
Note that spreadsheet applications may still auto-convert a quoted
"0805"on import; that is outside what the CSV can control, but the file itself now preserves the exact value.🤖 Generated with Claude Code