RSS

(root)/bmo/3.0 : 4587 (compared to revision 4963) : Bugzilla/Search/Quicksearch.pm

To get this branch, use:
bzr branch /bmo/3.0

« back to all changes in this revision

Viewing changes to Bugzilla/Search/Quicksearch.pm

lpsolit%gmail.com
2006-09-28 22:19:33
Revision ID: cvs-1:lpsolitgmail.com-20060929051933-7ryisr986z80ro7h
Fix on checkin for bug 354661

Show diffs side-by-side

added added

removed removed

409
409
    my @parts;
410
410
    my $i = 0;
411
411
 
 
412
    # Escape backslashes
 
413
    $string =~ s/\\/\\\//g;
 
414
 
412
415
    # Now split on quote sign; be tolerant about unclosed quotes
413
416
    @quoteparts = split(/"/, $string);
414
 
    foreach my $part (@quoteparts) {
415
 
        # After every odd quote, quote special chars
416
 
        $part = url_quote($part) if $i++ % 2;
 
417
    foreach (@quoteparts) {
 
418
        # After every odd quote, escape whitespace
 
419
        s/(\s)/\\$1/g if $i++ % 2;
417
420
    }
418
421
    # Join again
419
422
    $string = join('"', @quoteparts);
420
423
 
421
424
    # Now split on unescaped whitespace
422
 
    @parts = split(/\s+/, $string);
 
425
    @parts = split(/(?<!\\)\s+/, $string);
423
426
    foreach (@parts) {
 
427
        # Restore whitespace
 
428
        s/\\(\s)/$1/g;
 
429
        # Restore backslashes
 
430
        s/\\\//\\/g;
424
431
        # Remove quotes
425
432
        s/"//g;
426
433
    }
427
 
                        
428
434
    return @parts;
429
435
}
430
436
 
495
501
    my $cgi = Bugzilla->cgi;
496
502
    $cgi->param("field$expr", $field);
497
503
    $cgi->param("type$expr",  $type);
498
 
    $cgi->param("value$expr", url_decode($value));
 
504
    $cgi->param("value$expr", $value);
499
505
}
500
506
 
501
507
1;

Loggerhead 1.18.1 is a web-based interface for Bazaar branches