Bugzilla – Attachment 9190 Details for
Bug 7961
Local cover images should support CSV link files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7961 - Local cover images should support CSV link files
Bug-7961---Local-cover-images-should-support-CSV-l.patch (text/plain), 2.44 KB, created by
Dobrica Pavlinusic
on 2012-04-14 09:51:33 UTC
(
hide
)
Description:
Bug 7961 - Local cover images should support CSV link files
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2012-04-14 09:51:33 UTC
Size:
2.44 KB
patch
obsolete
>From b0eebc50fb77e1591eb0babbb2e23ae2748fbb77 Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Sat, 14 Apr 2012 11:39:20 +0200 >Subject: [PATCH] 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 | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) > >diff --git a/tools/upload-cover-image.pl b/tools/upload-cover-image.pl >index 7552e28..ed1fc5e 100755 >--- a/tools/upload-cover-image.pl >+++ b/tools/upload-cover-image.pl >@@ -143,10 +143,13 @@ if ($fileID) { > $error = 'DELERR'; > } > else { >- ( $biblionumber, $filename ) = split $delim, $line; >+ ( $biblionumber, $filename ) = split $delim, $line, 2; > $biblionumber =~ > s/[\"\r\n]//g; # remove offensive characters >- $filename =~ s/[\"\r\n\s]//g; >+ $filename =~ s/[\"\r\n]//g; >+ $filename =~ s/^\s+//; >+ $filename =~ s/\s+$//; >+ warn "## $total cover image biblionumber: $biblionumber file: $filename\n"; > my $srcimage = GD::Image->new("$dir/$filename"); > if ( defined $srcimage ) { > $total++; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7961
:
9190
|
9796
|
9960
|
10105