Changeset 27970 for main


Ignore:
Timestamp:
2013-08-05T17:05:24+12:00 (11 years ago)
Author:
ak19
Message:

Fix to regex. The regex sorting the ordering of the generated paged_img files needed to be corrected: the extra question mark makes the match less greedy. Before, the .* would match all the characters up to but exluding the last digitbefore the file extension. Instead, we want it to match all the chars up to but excluding the first digit (in a sequence of consecutive digits) before the file extension.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/util.pm

    r27819 r27970  
    12271227    sub page_number {
    12281228    my ($dir) = @_;
    1229     my ($pagenum) =($dir =~ m/^.*[-\.]?(\d+)(\.(jpg|gif|png))?$/i);
     1229    my ($pagenum) =($dir =~ m/^.*?[-\.]?(\d+)(\.(jpg|gif|png))?$/i);
     1230#   my ($pagenum) =($dir =~ m/(\d+)(\.(jpg|gif|png))?$/i); # this works but is not as safe/strict about input filepatterns as the above
    12301231
    12311232    $pagenum = 1 unless defined $pagenum;
Note: See TracChangeset for help on using the changeset viewer.