Skip to content

Commit

Permalink
Fixed an issue where pasting JSON data type values into the Result Gr…
Browse files Browse the repository at this point in the history
…id caused a syntax error by replacing our custom CSV-to-array conversion code with the PapaParse package. #8296
  • Loading branch information
anilsahoo20 committed Feb 12, 2025
1 parent 58bb142 commit 452e880
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"moment-timezone": "^0.5.34",
"notificar": "^1.0.1",
"notistack": "^3.0.1",
"papaparse": "^5.5.2",
"path-fx": "^2.0.0",
"postcss": "^8.4.31",
"rc-dock": "^3.2.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
//////////////////////////////////////////////////////////////
import JSONBigNumber from 'json-bignumber';
import _ from 'lodash';
import Papa from 'papaparse';
import * as clipboard from '../../../../../../static/js/clipboard';
import { CSVToArray } from '../../../../../../static/js/utils';

export default class CopyData {
constructor(options) {
Expand Down Expand Up @@ -91,7 +91,14 @@ export default class CopyData {

getCopiedRows() {
let copiedText = clipboard.getFromClipboard();
let copiedRows = CSVToArray(copiedText, this.CSVOptions.field_separator, this.CSVOptions.quote_char);

// Use papaparse to parse the CSV data
const parsedResult = Papa.parse(copiedText, {
delimiter: this.CSVOptions.field_separator,
quoteChar: this.CSVOptions.quote_char,
});

let copiedRows = parsedResult.data;

if(localStorage.getItem('copied-with-headers') == 'true') {
copiedRows = copiedRows.slice(1);
Expand Down

0 comments on commit 452e880

Please sign in to comment.