[Rt-commit] rt branch, 4.4/validator-asset-links, created. rt-4.4.1-156-g8cb7bc4

Jim Brandt jbrandt at bestpractical.com
Wed Dec 14 13:56:08 EST 2016


The branch, 4.4/validator-asset-links has been created
        at  8cb7bc4f948204f2faa0467c57807a2d4483bac1 (commit)

- Log -----------------------------------------------------------------
commit 8cb7bc4f948204f2faa0467c57807a2d4483bac1
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Dec 14 13:53:48 2016 -0500

    Update link checking regex to match asset links
    
    Previous RT link types looked like scheme://org/ticket/42,
    but asset links look like asset://org/42. Update the regex
    match in validator to treat the 'ticket' part of the URI as
    optional. This allows the validator to detect and fix asset links
    broken due to an Organization change.

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index f54b984..f6c99d1 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -975,7 +975,7 @@ push @CHECKS, 'Links: wrong organization' => sub {
             while ( my ($id, $value) = $sth->fetchrow_array ) {
                 $res = 0;
                 print STDERR "Record #$id in $table. Value of $column column most probably is an incorrect link\n";
-                my ($wrong_org) = ( $value =~ m{^\Q$scheme\E://(.+)/[^/]+/[0-9]*$} );
+                my ($wrong_org) = ( $value =~ m{^\Q$scheme\E://(.+)/(?:[^/]+/)*[0-9]*$} );
                 next unless my $replace_with = prompt(
                     'Replace',
                     "Column $column in $table is a link.  There is record #$id that has a"

-----------------------------------------------------------------------


More information about the rt-commit mailing list