Skip to content

Commit

Permalink
Issue #1778: also match the trailing slash of dirs
Browse files Browse the repository at this point in the history
when checking whether a file is in a dir
  • Loading branch information
bschmalhofer committed May 16, 2022
1 parent af4dcc6 commit 9022053
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions bin/otobo.CheckSum.pl
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,21 @@ sub ProcessDirectory {

# ignore directories
next FILE if $File =~ m{^doc/}smx;
next FILE if $File =~ m{^var/tmp}smx;
next FILE if $File =~ m{^var/log}smx;
next FILE if $File =~ m{^var/article}smx;
next FILE if $File =~ m{js-cache}smx;
next FILE if $File =~ m{css-cache}smx;

# next if not readable
open my $In, '<', $OrigFile or die "ERROR: $!"; ## no critic qw(OTOBO::ProhibitOpen OTOBO::ProhibitLowPrecedenceOps)

my $DigestGenerator = Digest::MD5->new();
$DigestGenerator->addfile($In);
my $Digest = $DigestGenerator->hexdigest();
close $In;
next FILE if $File =~ m{^var/tmp/}smx;
next FILE if $File =~ m{^var/log/}smx;
next FILE if $File =~ m{^var/article/}smx;
next FILE if $File =~ m{/js-cache/}smx;
next FILE if $File =~ m{/css-cache/}smx;

# generated the MD5 checksum
my $Digest;
{
open my $In, '<', $OrigFile or die "ERROR: $!"; ## no critic qw(OTOBO::ProhibitOpen OTOBO::ProhibitLowPrecedenceOps)
my $DigestGenerator = Digest::MD5->new();
$DigestGenerator->addfile($In);
$Digest = $DigestGenerator->hexdigest;
close $In;
}

if ( $Action eq 'create' ) {
print $Output $Digest . '::' . $File . "\n";
Expand Down

0 comments on commit 9022053

Please sign in to comment.