Bug 27869 - QotD CSV upload JavaScript errors
Summary: QotD CSV upload JavaScript errors
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Lucas Gass
QA Contact: Joonas Kylmälä
URL:
Keywords:
Depends on: 27251
Blocks:
  Show dependency treegraph
 
Reported: 2021-03-04 19:25 UTC by Lucas Gass
Modified: 2021-05-05 21:57 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
This patch handles malformed CSV errors by producing a warning on the page letting users know that the CSV filed uploaded has errors.
Version(s) released in:
21.05.00


Attachments
Bug 27869: let user know something went wrong with csv upload (1.88 KB, patch)
2021-03-04 19:43 UTC, Lucas Gass
Details | Diff | Splinter Review
bad_example.csv (195 bytes, text/csv)
2021-03-05 20:17 UTC, Lucas Gass
Details
Bug 27869: let user know something went wrong with csv upload (1.92 KB, patch)
2021-03-08 19:19 UTC, David Nind
Details | Diff | Splinter Review
Bug 27869: let user know something went wrong with csv upload (2.07 KB, patch)
2021-04-01 11:47 UTC, Joonas Kylmälä
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass 2021-03-04 19:25:18 UTC
On /cgi-bin/koha/tools/quotes-upload.pl if you upload a CSV that is not quite right the page produces a javascript error:

Uncaught TypeError: arrData[(arrData.length - 1)] is undefined

To the user this is confusing as #quotes_editor table visibility remains hidden and the progress bar says 100%. 

Can we handle this error better? Maybe a warning on the screen letting the user know something is wrong?
Comment 1 Lucas Gass 2021-03-04 19:43:12 UTC
Created attachment 117760 [details] [review]
Bug 27869: let user know something went wrong with csv upload

To test:
-attempt to upload a malformed CSV file
-nothing happens, check the console and see the error: Uncaught TypeError: arrData[(arrData.length - 1)] is undefined
-apply patch
-try again
-now you should at least see a warning that something went wrong
-attempt to upload a good CSV file, it should work
Comment 2 Owen Leonard 2021-03-05 14:26:42 UTC
(In reply to Lucas Gass from comment #1)
> -attempt to upload a malformed CSV file

Can you suggest how to make it malformed?
Comment 3 Lucas Gass 2021-03-05 20:17:01 UTC
Created attachment 117875 [details]
bad_example.csv
Comment 4 Lucas Gass 2021-03-05 20:17:22 UTC
(In reply to Owen Leonard from comment #2)
> (In reply to Lucas Gass from comment #1)
> > -attempt to upload a malformed CSV file
> 
> Can you suggest how to make it malformed?

I have attached an example file.
Comment 5 David Nind 2021-03-08 19:19:06 UTC
Created attachment 117949 [details] [review]
Bug 27869: let user know something went wrong with csv upload

To test:
-attempt to upload a malformed CSV file
-nothing happens, check the console and see the error: Uncaught TypeError: arrData[(arrData.length - 1)] is undefined
-apply patch
-try again
-now you should at least see a warning that something went wrong
-attempt to upload a good CSV file, it should work

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 Joonas Kylmälä 2021-04-01 11:47:05 UTC
Created attachment 119071 [details] [review]
Bug 27869: let user know something went wrong with csv upload

To test:
-attempt to upload a malformed CSV file
-nothing happens, check the console and see the error: Uncaught TypeError: arrData[(arrData.length - 1)] is undefined
-apply patch
-try again
-now you should at least see a warning that something went wrong
-attempt to upload a good CSV file, it should work

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Comment 7 Jonathan Druart 2021-04-01 16:54:26 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 8 Fridolin Somers 2021-04-15 10:20:01 UTC
Looks like it depends a bit on Bug 27251 not in 20.11.x

Not pushed to 20.11.x