Skip to content

Commit

Permalink
Item13697: Item13728: Use File::Copy::Recursive::rmove()
Browse files Browse the repository at this point in the history
File::Copy::move() fails copying symlinked resources.
File::Copy::Recursive::rmove() does the right thing.

Also noticed missing "CROAK" flag for the encode of file names.
  • Loading branch information
gac410 committed Sep 19, 2015
1 parent cbfbe4b commit bca91a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions RCSStoreContrib/data/System/RCSStoreContrib.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1442032214" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1442706096" format="1.1" version="1"}%
<!--
One line description, required for extensions repository catalog.
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
Expand Down Expand Up @@ -65,12 +65,13 @@ diff lib/Foswiki/Store/Rcs/RcsLiteHandler.pm lib/Foswiki/Store/Rcs/RcsLiteHandle

| Dependencies: | %$DEPENDENCIES% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 1.01 (11 Sep 2015): | Item13697: Reject unsupported characters from web/topic and attachment filenames. |
| 1.01 (11 Sep 2015): | Foswikitask:Item13697: Reject unsupported characters from web/topic and attachment filenames.<br/>\
Foswikitask:Item13728: Rename fails for symlinked attachments. |
| 1.00 (10 May 2013): | Initial version, abstracted from core |

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="ProjectContributor"}%
%META:FIELD{name="Copyright" title="Copyright" value="Foswiki Contributors, All Rights Reserved"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2015 Foswiki Contributors, All Rights Reserved"}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/%$ROOTMODULE%"}%
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
%META:FIELD{name="Release" title="Release" value="%$RELEASE%"}%
Expand Down
12 changes: 7 additions & 5 deletions RCSStoreContrib/lib/Foswiki/Store/Rcs/Handler.pm
Expand Up @@ -30,10 +30,12 @@ use strict;
use warnings;
use Assert;

use IO::File ();
use File::Copy ();
use File::Spec ();
use File::Path ();
use IO::File ();
use File::Copy ();
use File::Copy::Recursive ();
use File::Spec ();
use File::Path ();

use Fcntl qw( :DEFAULT :flock SEEK_SET );
use Encode ();
use JSON ();
Expand Down Expand Up @@ -1091,7 +1093,7 @@ sub _moveFile {
my ( $this, $from, $to ) = @_;
ASSERT( _e $from ) if DEBUG;
$this->mkPathTo($to);
unless ( File::Copy::move( _encode( $from, 1 ), _encode( $to, 1 ) ) ) {
unless ( File::Copy::Recursive::rmove( _encode($from, 1), _encode($to, 1) ) ) {
throw Error::Simple(
'Rcs::Handler: move ' . $from . ' to ' . $to . ' failed: ' . $! );
}
Expand Down

0 comments on commit bca91a0

Please sign in to comment.