Hello community,

here is the log from the commit of package perl-Mojolicious for 
openSUSE:Factory checked in at 2018-09-13 12:10:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Mojolicious"

Thu Sep 13 12:10:31 2018 rev:100 rq:632860 version:7.94

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes        
2018-08-18 00:05:14.851280840 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes   
2018-09-13 12:10:34.682357281 +0200
@@ -1,0 +2,13 @@
+Sat Sep  1 05:39:49 UTC 2018 - [email protected]
+
+- updated to 7.94
+   see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+  7.94  2018-08-27
+    - Added EXPERIMENTAL content_type and file_type methods to 
Mojolicious::Types.
+    - Fixed a bug where the reply->file helper would not try to set a 
Content-Type
+      header.
+    - Fixed a bug where the render method in Mojolicious::Controller would not
+      always use Mojolicious::Types to find the correct Content-Type value.
+
+-------------------------------------------------------------------

Old:
----
  Mojolicious-7.93.tar.gz

New:
----
  Mojolicious-7.94.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.trGVte/_old  2018-09-13 12:10:35.118356792 +0200
+++ /var/tmp/diff_new_pack.trGVte/_new  2018-09-13 12:10:35.122356786 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Mojolicious
-Version:        7.93
+Version:        7.94
 Release:        0
 %define cpan_name Mojolicious
 Summary:        Real-time web framework

++++++ Mojolicious-7.93.tar.gz -> Mojolicious-7.94.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/Changes new/Mojolicious-7.94/Changes
--- old/Mojolicious-7.93/Changes        2018-08-11 13:52:07.000000000 +0200
+++ new/Mojolicious-7.94/Changes        2018-08-27 19:35:37.000000000 +0200
@@ -1,4 +1,11 @@
 
+7.94  2018-08-27
+  - Added EXPERIMENTAL content_type and file_type methods to 
Mojolicious::Types.
+  - Fixed a bug where the reply->file helper would not try to set a 
Content-Type
+    header.
+  - Fixed a bug where the render method in Mojolicious::Controller would not
+    always use Mojolicious::Types to find the correct Content-Type value.
+
 7.93  2018-08-11
   - Improved Test::Mojo to accept Mojo::File objects pointing to application
     scripts and to override configurations more consistently.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/META.json 
new/Mojolicious-7.94/META.json
--- old/Mojolicious-7.93/META.json      2018-08-12 16:22:23.000000000 +0200
+++ new/Mojolicious-7.94/META.json      2018-08-31 14:52:00.000000000 +0200
@@ -58,6 +58,6 @@
       },
       "x_IRC" : "irc://irc.perl.org/#mojo"
    },
-   "version" : "7.93",
+   "version" : "7.94",
    "x_serialization_backend" : "JSON::PP version 2.97001"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/META.yml 
new/Mojolicious-7.94/META.yml
--- old/Mojolicious-7.93/META.yml       2018-08-12 16:22:22.000000000 +0200
+++ new/Mojolicious-7.94/META.yml       2018-08-31 14:52:00.000000000 +0200
@@ -31,5 +31,5 @@
   homepage: https://mojolicious.org
   license: http://www.opensource.org/licenses/artistic-license-2.0
   repository: https://github.com/kraih/mojo.git
-version: '7.93'
+version: '7.94'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/README.md 
new/Mojolicious-7.94/README.md
--- old/Mojolicious-7.93/README.md      2018-08-07 13:21:46.000000000 +0200
+++ new/Mojolicious-7.94/README.md      2018-08-15 16:39:26.000000000 +0200
@@ -35,7 +35,7 @@
       highly scalable web services.
     * JSON and HTML/XML parser with CSS selector support.
   * Very clean, portable and object-oriented pure-Perl API with no hidden
-    magic and no requirements besides Perl 5.24.0 (versions as old as 5.10.1
+    magic and no requirements besides Perl 5.26.0 (versions as old as 5.10.1
     can be used too, but may require additional CPAN modules to be installed)
   * Fresh code based upon years of experience developing
     [Catalyst](http://www.catalystframework.org), free and open source.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/lib/Mojo/Content/MultiPart.pm 
new/Mojolicious-7.94/lib/Mojo/Content/MultiPart.pm
--- old/Mojolicious-7.93/lib/Mojo/Content/MultiPart.pm  2018-05-29 
21:53:40.000000000 +0200
+++ new/Mojolicious-7.94/lib/Mojo/Content/MultiPart.pm  2018-08-23 
22:35:36.000000000 +0200
@@ -41,9 +41,9 @@
 
   # Add boundary to Content-Type header
   my $headers = $self->headers;
-  ($headers->content_type // '') =~ m!^(.*multipart/[^;]+)(.*)$!;
-  my $before = $1 || 'multipart/mixed';
-  my $after  = $2 || '';
+  my ($before, $after) = ('multipart/mixed', '');
+  ($before, $after) = ($1, $2)
+    if ($headers->content_type // '') =~ m!^(.*multipart/[^;]+)(.*)$!;
   $headers->content_type("$before; boundary=$boundary$after");
 
   return $boundary;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/lib/Mojolicious/Controller.pm 
new/Mojolicious-7.94/lib/Mojolicious/Controller.pm
--- old/Mojolicious-7.93/lib/Mojolicious/Controller.pm  2018-08-08 
20:55:35.000000000 +0200
+++ new/Mojolicious-7.94/lib/Mojolicious/Controller.pm  2018-08-22 
21:59:20.000000000 +0200
@@ -186,9 +186,8 @@
     unless defined $output;
 
   $plugins->emit_hook(after_render => $self, \$output, $format);
-  my $headers = $self->res->body($output)->headers;
-  $headers->content_type($app->types->type($format) || 'text/plain')
-    unless $headers->content_type;
+  $self->res->body($output);
+  $app->types->content_type($self, {ext => $format});
   return !!$self->rendered($stash->{status});
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/lib/Mojolicious/Guides/FAQ.pod 
new/Mojolicious-7.94/lib/Mojolicious/Guides/FAQ.pod
--- old/Mojolicious-7.93/lib/Mojolicious/Guides/FAQ.pod 2018-08-08 
17:07:40.000000000 +0200
+++ new/Mojolicious-7.94/lib/Mojolicious/Guides/FAQ.pod 2018-08-15 
16:39:05.000000000 +0200
@@ -54,7 +54,9 @@
 necessary freedom to ensure a healthy future for L<Mojolicious>. So, as long as
 you are not using anything marked experimental, untested or undocumented, you
 can always count on backwards compatibility, everything else would be
-considered a bug.
+considered a bug. However, to completely avoid any risk of accidental breakage,
+we do recommend following current best practices for version pinning with
+L<Carton> for production setups.
 
 =head2 Why not split up Mojolicious into many smaller distributions?
 
@@ -73,11 +75,12 @@
 
 First of all, you need to be aware that according to the L<perlpolicy>, only
 the two most recent stable release series of Perl are supported by the
-community and receive bug fixes, which are currently 5.26.x and 5.24.x.
+community and receive bug fixes, which are currently 5.28.x and 5.26.x.
 L<Mojolicious> follows this model and fully supports these two release series.
-In addition we will also keep the distribution installable up to a certain
-legacy version that we deem worthy of supporting, but not specifically optimize
-for it, this is currently 5.10.1.
+In addition we will also keep the distribution installable (and that means
+passing all tests) up to a certain legacy version that the core team deems
+worthy of supporting, but not specifically optimize for it, this is currently
+5.10.1.
 
 =head2 How well is Windows supported by Mojolicious?
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/lib/Mojolicious/Routes/Route.pm 
new/Mojolicious-7.94/lib/Mojolicious/Routes/Route.pm
--- old/Mojolicious-7.93/lib/Mojolicious/Routes/Route.pm        2018-05-08 
18:40:00.000000000 +0200
+++ new/Mojolicious-7.94/lib/Mojolicious/Routes/Route.pm        2018-08-27 
19:36:29.000000000 +0200
@@ -615,6 +615,9 @@
 L<Mojolicious::Guides::Tutorial> and L<Mojolicious::Guides::Routing> for more
 information.
 
+  # Longer version
+  $r->any('/:foo' => sub {...})->inline(1);
+
   # Intermediate destination and prefix shared between two routes
   my $auth = $r->under('/user')->to('user#auth');
   $auth->get('/show')->to('#show');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/lib/Mojolicious/Static.pm 
new/Mojolicious-7.94/lib/Mojolicious/Static.pm
--- old/Mojolicious-7.93/lib/Mojolicious/Static.pm      2018-05-11 
18:20:42.000000000 +0200
+++ new/Mojolicious-7.94/lib/Mojolicious/Static.pm      2018-08-22 
22:15:01.000000000 +0200
@@ -81,21 +81,17 @@
 
 sub serve {
   my ($self, $c, $rel) = @_;
-
   return undef unless my $asset = $self->file($rel);
-  my $headers = $c->res->headers;
-  return !!$self->serve_asset($c, $asset) if $headers->content_type;
-
-  # Content-Type
-  my $types = $c->app->types;
-  my $type = $rel =~ /\.(\w+)$/ ? $types->type($1) : undef;
-  $headers->content_type($type || $types->type('txt'));
+  $c->app->types->content_type($c, {file => $rel});
   return !!$self->serve_asset($c, $asset);
 }
 
 sub serve_asset {
   my ($self, $c, $asset) = @_;
 
+  # Content-Type
+  $c->app->types->content_type($c, {file => $asset->path}) if $asset->is_file;
+
   # Last-Modified and ETag
   my $res = $c->res;
   $res->code(200)->headers->accept_ranges('bytes');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/lib/Mojolicious/Types.pm 
new/Mojolicious-7.94/lib/Mojolicious/Types.pm
--- old/Mojolicious-7.93/lib/Mojolicious/Types.pm       2018-05-08 
18:40:00.000000000 +0200
+++ new/Mojolicious-7.94/lib/Mojolicious/Types.pm       2018-08-24 
00:49:37.000000000 +0200
@@ -32,6 +32,16 @@
   };
 };
 
+sub content_type {
+  my ($self, $c, $o) = (shift, shift, shift // {});
+
+  my $headers = $c->res->headers;
+  return undef if $headers->content_type;
+
+  my $type = $o->{file} ? $self->file_type($o->{file}) : 
$self->type($o->{ext});
+  $headers->content_type($type // $self->type('txt'));
+}
+
 sub detect {
   my ($self, $accept) = @_;
 
@@ -53,6 +63,8 @@
   return [map { @{$reverse{$_} // []} } @detected];
 }
 
+sub file_type { $_[1] =~ /\.(\w+)$/ ? $_[0]->type($1) : undef }
+
 sub type {
   my ($self, $ext, $type) = @_;
   return $self->mapping->{lc $ext}[0] unless $type;
@@ -125,6 +137,33 @@
 L<Mojolicious::Types> inherits all methods from L<Mojo::Base> and implements
 the following new ones.
 
+=head2 content_type
+
+  $types->content_type(Mojolicious::Controller->new, {ext => 'json'});
+
+Detect MIME type for L<Mojolicious::Controller> object unless a C<Content-Type>
+response header has already been set, defaults to using the MIME type for the
+C<txt> extension if no better alternative could be found. Note that this method
+is EXPERIMENTAL and might change without warning!
+
+These options are currently available:
+
+=over 2
+
+=item ext
+
+  ext => 'json'
+
+File extension to get MIME type for.
+
+=item file
+
+  file => 'foo/bar.png'
+
+File path to get MIME type for.
+
+=back
+
 =head2 detect
 
   my $exts = $types->detect('text/html, application/json;q=9');
@@ -134,6 +173,13 @@
   # List detected extensions prioritized
   say for @{$types->detect('application/json, text/xml;q=0.1', 1)};
 
+=head2 file_type
+
+  my $type = $types->file_type('foo/bar.png');
+
+Get MIME type for file path. Note that this method is EXPERIMENTAL and might
+change without warning!
+
 =head2 type
 
   my $type = $types->type('png');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/lib/Mojolicious.pm 
new/Mojolicious-7.94/lib/Mojolicious.pm
--- old/Mojolicious-7.93/lib/Mojolicious.pm     2018-08-10 13:16:18.000000000 
+0200
+++ new/Mojolicious-7.94/lib/Mojolicious.pm     2018-08-27 19:34:38.000000000 
+0200
@@ -65,7 +65,7 @@
 has validator => sub { Mojolicious::Validator->new };
 
 our $CODENAME = 'Doughnut';
-our $VERSION  = '7.93';
+our $VERSION  = '7.94';
 
 sub AUTOLOAD {
   my $self = shift;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/t/mojolicious/layouted_lite_app.t 
new/Mojolicious-7.94/t/mojolicious/layouted_lite_app.t
--- old/Mojolicious-7.93/t/mojolicious/layouted_lite_app.t      2018-02-19 
00:43:11.000000000 +0100
+++ new/Mojolicious-7.94/t/mojolicious/layouted_lite_app.t      2018-08-22 
22:00:22.000000000 +0200
@@ -229,8 +229,8 @@
 
 # Filter
 $t->get_ok('/plain/reverse')->status_is(200)
-  ->header_is(Server => 'Mojolicious (Perl)')->content_type_is('text/plain')
-  ->content_is('oof!olleH');
+  ->header_is(Server => 'Mojolicious (Perl)')
+  ->content_type_is('text/plain;charset=UTF-8')->content_is('oof!olleH');
 
 # Layout in render call
 $t->get_ok('/outerlayout')->status_is(200)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/t/mojolicious/static_lite_app.t 
new/Mojolicious-7.94/t/mojolicious/static_lite_app.t
--- old/Mojolicious-7.93/t/mojolicious/static_lite_app.t        2018-05-14 
23:34:13.000000000 +0200
+++ new/Mojolicious-7.94/t/mojolicious/static_lite_app.t        2018-08-22 
22:17:31.000000000 +0200
@@ -177,6 +177,7 @@
 
 # File
 $t->get_ok('/file' => {'Range' => 'bytes=4-9'})->status_is(206)
+  ->content_type_is('text/plain;charset=UTF-8')
   ->header_is(Server => 'Mojolicious (Perl)')->content_is('answer');
 
 # Empty file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.93/t/mojolicious/types.t 
new/Mojolicious-7.94/t/mojolicious/types.t
--- old/Mojolicious-7.93/t/mojolicious/types.t  2018-05-08 18:39:22.000000000 
+0200
+++ new/Mojolicious-7.94/t/mojolicious/types.t  2018-08-22 22:31:30.000000000 
+0200
@@ -1,6 +1,7 @@
 use Mojo::Base -strict;
 
 use Test::More;
+use Mojolicious;
 use Mojolicious::Types;
 
 # Basic functionality
@@ -79,4 +80,25 @@
 is_deeply $t->detect('application/json, text/javascript, */*; q=0.01'),
   ['json'], 'right formats';
 
+# File types
+is $t->file_type('foo/bar.png'), 'image/png',              'right type';
+is $t->file_type('foo/bar.js'),  'application/javascript', 'right type';
+is $t->file_type('foo/bar'),     undef,                    'no type';
+
+# Content types
+my $c = Mojolicious->new->build_controller;
+$t->content_type($c, {ext => 'json'});
+is $c->res->headers->content_type, 'application/json', 'right type';
+$t->content_type($c, {ext => 'txt'});
+is $c->res->headers->content_type, 'application/json', 'type not changed';
+$c->res->headers->remove('Content-Type');
+$t->content_type($c, {ext => 'html'});
+is $c->res->headers->content_type, 'text/html;charset=UTF-8', 'right type';
+$c->res->headers->remove('Content-Type');
+$t->content_type($c, {ext => 'unknown'});
+is $c->res->headers->content_type, 'text/plain;charset=UTF-8', 'right type';
+$c->res->headers->remove('Content-Type');
+$t->content_type($c, {file => 'foo/bar.png'});
+is $c->res->headers->content_type, 'image/png', 'right type';
+
 done_testing();


Reply via email to