Ignore:
Timestamp:
Dec 15, 2004, 2:18:35 PM (17 years ago)
Author:
kake
Message:

Fixed bug that allowed autocreation of locales and categories with trailing spaces in the name.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/Template.pm

    r591 r592  
    246246        my $categories_text = $q->param('categories');
    247247        my $locales_text    = $q->param('locales');
    248         @catlist = sort split("\r\n", $categories_text);
    249         @loclist = sort split("\r\n", $locales_text);
     248        @catlist = sort map { s/^\s+//; s/\s+$//; $_; } # trim lead/trail space
     249                        split("\r\n", $categories_text);
     250        @loclist = sort map { s/^\s+//; s/\s+$//; $_; } # trim lead/trail space
     251                        split("\r\n", $locales_text);
    250252    }
    251253
     
    337339            # integerification by postgres and it's an easy mistake to
    338340            # make when typing into a form.
    339             $os_x =~ s/\s+//;
    340             $os_y =~ s/\s+//;
     341            $os_x =~ s/\s+//g;
     342            $os_y =~ s/\s+//g;
    341343
    342344            # If we were sent x and y, work out lat/long; and vice versa.
     
    380382            my $long   = $q->param("longitude");
    381383
    382             # Trim whitespace - trailing whitespace buggers up the
    383             # integerification by postgres and it's an easy mistake to
    384             # make when typing into a form.
    385             $osie_x =~ s/\s+//;
    386             $osie_y =~ s/\s+//;
     384            # Trim whitespace.
     385            $osie_x =~ s/\s+//g;
     386            $osie_y =~ s/\s+//g;
    387387
    388388            # If we were sent x and y, work out lat/long; and vice versa.
     
    424424            my $long   = $q->param("longitude");
    425425            if ( $lat && $long ) {
     426                # Trim whitespace.
     427                $lat =~ s/\s+//g;
     428                $long =~ s/\s+//g;
    426429                my ($zone, $easting, $northing) =
    427430                 Geo::Coordinates::UTM::latlon_to_utm( $config->ellipsoid,
Note: See TracChangeset for help on using the changeset viewer.