Skip to content

Commit

Permalink
fix a bug in Mojo::File where parts of a path could get accidentally …
Browse files Browse the repository at this point in the history
…upgraded from bytes to characters (closes #1131)
  • Loading branch information
kraih committed Oct 5, 2017
1 parent dea681a commit 0c47879
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Changes
@@ -1,6 +1,8 @@

7.47 2017-10-03
7.47 2017-10-05
- Added multipart content generator to Mojo::UserAgent::Transactor.
- Fixed a bug in Mojo::File where parts of a path could get accidentally
upgraded from bytes to characters.

7.46 2017-09-12
- Fixed support for versions of IO::Socket::SSL older than 1.965 again.
Expand Down
4 changes: 4 additions & 0 deletions lib/Mojo/File.pm
Expand Up @@ -78,6 +78,10 @@ sub move_to {

sub new {
my $class = shift;

# File systems require bytes, make sure we don't accidentally upgrade
utf8::downgrade $_, 1 for @_;

my $value = @_ == 1 ? $_[0] : @_ > 1 ? catfile @_ : canonpath getcwd;
return bless \$value, ref $class || $class;
}
Expand Down

0 comments on commit 0c47879

Please sign in to comment.