From 84ed6c3cc682e59c9e24d3bd9602729c6e658491 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 16 Sep 2015 13:53:38 +0200 Subject: [PATCH] Bug 14321: [QA Follow-up] Changes for Upload.pm and upload-file.pl Content-Type: text/plain; charset=utf-8 Based on QA comments, this patch does the following: [1] Destroy an empty DESTROY. [2] Promote some comment lines to POD. [3] Use File::Spec->catfile in sub _full_fname. [4] Add a comment in upload-file.pl. Signed-off-by: Marcel de Rooy Run the unit test again, and uploaded a file. --- Koha/Upload.pm | 17 +++++++++-------- tools/upload-file.pl | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Koha/Upload.pm b/Koha/Upload.pm index 9b580ec..274b6b0 100644 --- a/Koha/Upload.pm +++ b/Koha/Upload.pm @@ -211,10 +211,7 @@ sub delete { return @res; } -sub DESTROY { -} - -# ************** HELPER ROUTINES / CLASS METHODS ****************************** +=head1 CLASS METHODS =head2 getCategories @@ -243,7 +240,9 @@ sub httpheaders { ); } -# ************** INTERNAL ROUTINES ******************************************** +=head1 INTERNAL ROUTINES + +=cut sub _init { my ( $self, $params ) = @_; @@ -310,9 +309,11 @@ sub _full_fname { my ( $self, $rec ) = @_; my $p; if( ref $rec ) { - $p= $rec->{permanent}? $self->{rootdir}: $self->{tmpdir}; - $p.= '/'; - $p.= $rec->{dir}. '/'. $rec->{hashvalue}. '_'. $rec->{filename}; + $p = File::Spec->catfile( + $rec->{permanent}? $self->{rootdir}: $self->{tmpdir}, + $rec->{dir}, + $rec->{hashvalue}. '_'. $rec->{filename} + ); } return $p; } diff --git a/tools/upload-file.pl b/tools/upload-file.pl index f54d6b1..1994214 100755 --- a/tools/upload-file.pl +++ b/tools/upload-file.pl @@ -81,7 +81,8 @@ sub send_reply { # response will be sent back as JSON }); } -sub upload_pars { +sub upload_pars { # this sub parses QUERY_STRING in order to build the + # parameter hash for Koha::Upload my ( $qstr ) = @_; $qstr = Encode::decode_utf8( uri_unescape( $qstr ) ); # category could include a utf8 character -- 1.7.10.4