Bug #1388 Solution #1393
Conversation
…rt correctly in CSVs from datatable
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughReplaces a local CSV-escaping helper in the table dropdown with shared utilities: adds functions to extract object names, flatten arrays, and format values as CSV-safe fields (including formula-injection mitigation and quote escaping), and updates the component to use the new formatter for headers and cell values. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Security Recommendations
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@frontend/lib/utils.ts`:
- Around line 85-87: The current guard only matches formula chars at string
start and misses cases with leading whitespace (e.g. " =1+1"), so update the
regex that tests the variable str in the CSV sanitization logic to detect
formula characters even when preceded by whitespace — replace the test
/^[=+\-@]/ with one that allows any leading whitespace (e.g. /^\s*[=+\-@]/) and
keep the existing behavior of prefixing the string with a single quote when a
match occurs; refer to the variable str and the regex test in the CSV
export/sanitization function to locate and update the check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9a329c62-6a63-47d7-a441-9ea4b681d009
📒 Files selected for processing (2)
frontend/components/Item/View/table/data-table-dropdown.vuefrontend/lib/utils.ts
What type of PR is this?
What this PR does / why we need it:
Fixes bug where location is exported incorrectly when "Download Table as CSV" is selected
Which issue(s) this PR fixes:
Fixes #1388
Special notes for your reviewer:
I decided to put everything in
~/lib/utilsbecause the code is generic enough to be useful elsewhere. I was also thinking about adding the ability to show tags in the datatable in a later PR, hence why I also added theformatArrayAsStringfunction.Testing
Manually tested by exporting table as CSV when an item that belongs to a child location is tested. Verified that the location was the string representation of the location instead of "[object Object]"
Summary by CodeRabbit
New Features
Bug Fixes