diff options
author | Asad Memon <asadmemon@google.com> | 2023-04-20 18:22:04 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-20 18:22:04 +0000 |
commit | aa808b30c00588c9eba08ac3da1adc16301396f0 (patch) | |
tree | 8f04d045d75f3209d753ff93b3148f84a2030c1d /pw_web | |
parent | de55dbeb9388f75c44bfb5d0f3d546e112f804f1 (diff) | |
download | pigweed-aa808b30c00588c9eba08ac3da1adc16301396f0.tar.gz |
pw_web: Remove faulty csv validator from console
This validator is pretty basic (like it throws if there are new lines in a csv field) and probably does not belong here. The underlying pw_tokenizer works fine even if some lines in csv are bad.
Plan to improve the parsing logic in pw_tokenizer itself rather than in sample web console.
Change-Id: I7e82fc159358b4f51509d8d5097fa63999b157f1
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/140110
Reviewed-by: Taylor Cramer <cramertj@google.com>
Commit-Queue: Asad Memon <asadmemon@google.com>
Diffstat (limited to 'pw_web')
-rw-r--r-- | pw_web/webconsole/components/uploadDb.tsx | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/pw_web/webconsole/components/uploadDb.tsx b/pw_web/webconsole/components/uploadDb.tsx index 11a6ea9a5..3b01fb0bd 100644 --- a/pw_web/webconsole/components/uploadDb.tsx +++ b/pw_web/webconsole/components/uploadDb.tsx @@ -20,16 +20,6 @@ interface Props { onUpload: (db: string) => void } -function testTokenDB(tokenCsv: string) { - const lines = tokenCsv.trim().split(/\r?\n/).map(line => line.split(/,/)); - lines.forEach((line) => { - // CSV has no columns or has malformed number. - if (line.length < 2 || !/^[a-fA-F0-9]+$/.test(line[0])) { - throw new Error("Not a valid token database.") - } - }); -} - export default function BtnUploadDB({onUpload}: Props) { const [uploaded, setUploaded] = useState(false); const [error, setError] = useState(""); @@ -46,7 +36,6 @@ export default function BtnUploadDB({onUpload}: Props) { onChange={async e => { const tokenCsv = await readFile(e.target.files![0]); try { - testTokenDB(tokenCsv); onUpload(tokenCsv); setUploaded(true); setError(""); |