
theory at bricolage
Mar 11, 2009, 11:55 AM
Post #1 of 1
(444 views)
Permalink
|
|
[8489] Fixed an issue where a document gets renamed so that a single
|
|
Revision: 8489 Author: theory Date: 2009-03-11 11:55:37 -0700 (Wed, 11 Mar 2009) ViewCVS: http://viewsvn.bricolage.cc/?rev=8489&view=rev Log Message: ----------- Fixed an issue where a document gets renamed so that a single character is replaced with an underscore: The old file was not getting removed upon publish. Reported by Ashlee Caul (Bug #1446). [David] Bugzilla Links: -------------- http://bugs.bricolage.cc/show_bug.cgi?id=1446 Modified Paths: -------------- bricolage/branches/rev_1_10/lib/Bric/Changes.pod bricolage/branches/rev_1_10/lib/Bric/Util/Burner.pm Modified: bricolage/branches/rev_1_10/lib/Bric/Changes.pod =================================================================== --- bricolage/branches/rev_1_10/lib/Bric/Changes.pod 2009-03-11 18:39:24 UTC (rev 8488) +++ bricolage/branches/rev_1_10/lib/Bric/Changes.pod 2009-03-11 18:55:37 UTC (rev 8489) @@ -151,6 +151,12 @@ Eliminated a SQL injection vulnerability in the querying for stories, media, and templates. [David] +=item * + +Fixed an issue where a document gets renamed so that a single character is +replaced with an underscore: The old file was not getting removed upon +publish. Reported by Ashlee Caul (Bug #1446). [David] + =back =head1 VERSION 1.10.6 (2008-10-02) Modified: bricolage/branches/rev_1_10/lib/Bric/Util/Burner.pm =================================================================== --- bricolage/branches/rev_1_10/lib/Bric/Util/Burner.pm 2009-03-11 18:39:24 UTC (rev 8488) +++ bricolage/branches/rev_1_10/lib/Bric/Util/Burner.pm 2009-03-11 18:55:37 UTC (rev 8489) @@ -1242,10 +1242,11 @@ if ($exp_date && $exp_date lt $publish_date) { # Don't really publish it, just expire it. return 1 unless $ba->get_publish_status; + (my $search_path = $base_path) =~ s/([_%])/\\$1/g; my @stale = Bric::Dist::Resource->list({ "$key\_id" => $baid, $key eq 'story' - ? (path => "$base_path/%") + ? (path => "$search_path/%") : (oc_id => $oc->get_id), }) or next; my $expname = 'Expire "' . $ba->get_name . @@ -1289,8 +1290,13 @@ # Save the job. $job->save; log_event('job_new', $job); + + # Stash away its ID and the SQL LIKE-escaped URI. push @job_ids, $job->get_id; - $uris{$_->get_uri} = undef for $job->get_resources; + $uris{$_} = undef for map { + (my $u = $_->get_uri) =~ s/([_%])/\\$1/g; + $u; + } $job->get_resources; # Set up an expire job, if necessary. if ($exp_date and my @res = $job->get_resources) { @@ -2176,8 +2182,8 @@ sub _get_resource { my ($path, $uri) = @_; - ( my $lpath = $path) =~ s/([%_])/\\$1/g; - ( my $luri = $uri) =~ s/([%_])/\\$1/g; + ( my $lpath = $path) =~ s/([_%])/\\$1/g; + ( my $luri = $uri) =~ s/([_%])/\\$1/g; return Bric::Dist::Resource->lookup({ path => $lpath, uri => $luri,
|