Bug 30982: (QA follow-up) Spelling
[srvgit] / Koha / REST / V1 / Static.pm
index d0f31c9..2b7f20e 100644 (file)
@@ -2,24 +2,24 @@ package Koha::REST::V1::Static;
 
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 3 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
 
 use Mojo::Base 'Mojolicious::Controller';
 
-use Try::Tiny;
+use Try::Tiny qw( catch try );
 
 =head1 API
 
@@ -27,7 +27,7 @@ use Try::Tiny;
 
 =head3 get
 
-Mehtod that gets file contents
+Method that gets file contents
 
 =cut
 
@@ -35,8 +35,7 @@ sub get {
     my $self = shift;
     my $c = $self->openapi->valid_input or return;
 
-    if (   C4::Context->preference('UseKohaPlugins')
-        && C4::Context->config("enable_plugins") )
+    if ( C4::Context->config("enable_plugins") )
     {
         my $path = $c->req->url->path->leading_slash(1);
 
@@ -55,7 +54,7 @@ sub get {
         );
 
         @plugins = grep { $_->api_namespace eq $namespace} @plugins;
-        warn scalar(@plugins);
+
         return $c->render({ status => 404, openapi => { error => 'File not found' } }) unless scalar(@plugins) > 0;
         return $c->render({ status => 500, openapi => { error => 'Namespace not unique' } }) unless scalar(@plugins) == 1;
 
@@ -63,17 +62,11 @@ sub get {
 
         my $basepath = $plugin->bundle_path;
 
-        warn $basepath;
-
         my $relpath = join ('/', splice (@$path, 5));
 
-        warn $relpath;
-
-        warn join('/', $basepath, $relpath);
         return try {
             my $asset = Mojo::Asset::File->new(path => join('/', $basepath, $relpath));
             return $c->render({ status => 404, openapi => { error => 'File not found' } }) unless $asset->is_file;
-            # $c->res->headers->content_type("image/jpeg");
             return $c->reply->asset($asset);
         }
         catch {
@@ -87,4 +80,4 @@ sub get {
 
 }
 
-1;
\ No newline at end of file
+1;