Bug 7961 - Local cover images should support CSV link files
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 14 Apr 2012 09:39:20 +0000 (11:39 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 25 Apr 2012 22:01:25 +0000 (00:01 +0200)
commit84f53799d7574693e1dd520230a2bba9ab439703
tree8e70bc8e5c253b8f910b09207e4fccb13e06b2c4
parent5c32a9f811d8506f9230be60e2410320141f786e
Bug 7961 - Local cover images should support CSV link files

Corrent code doesn't have support for filenames which contain spaces
or commans which breaks CSV files saved from spreadsheet similar to:

  12345, "conver image, with spaces.jpg"

This patch tweaks file parsing a bit. We are always splitting line to
only two values (to support commas as part of filename) and removing
spaces only on beginning and end of filename (to cover space after
comma in CSV example above while preserving spaces in filename).

With this change only invalid character in picture filename left
are quotes (") which are commonly used to quote strings with spaces.

Also added is simple debug warn which displays number of cover image
uploaded, biblionumber and filename which is very useful when uploading
huge zip files with covers, because progress can be monitored in log.

Test scenario:

1. collect pictures with spaces and commas in name
2. dump file list into CSV file and add biblio number as first column
3. create zip with CSV file and pictures
4. verify that all pictures got uploaded and linked to biblio records
tools/upload-cover-image.pl