[Rt-devel] [Rt-commit] rt branch, 4.0/dashboard-chart-with-umlauts, created. rt-4.0.1-298-gc6fb9f5

Ruslan Zakirov ruz at bestpractical.com
Mon Aug 8 13:13:49 EDT 2011


Regards, Ruslan. From phone.
08.08.2011 14:01 пользователь "? sunnavy" <sunnavy at bestpractical.com>
написал:
>
> The branch, 4.0/dashboard-chart-with-umlauts has been created
>        at  c6fb9f54c37142df0089145c12ab4feab52d7d27 (commit)
>
> - Log -----------------------------------------------------------------
> commit c0ec1787729093b2064a36c9ef5cce5e84b763d5
> Author: sunnavy <sunnavy at bestpractical.com>
> Date:   Mon Aug 8 17:31:41 2011 +0800
>
>    turn off utf8 as uri string is utf8 encoded, see also #18104
>
> diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
> index f6b1685..ae10d21 100644
> --- a/lib/RT/Dashboard/Mailer.pm
> +++ b/lib/RT/Dashboard/Mailer.pm
> @@ -476,7 +476,9 @@ sub BuildEmail {
>  }
>
>  sub GetResource {
> -    my $uri = URI->new(shift);
> +    my $string = shift;
> +    Encode::_utf8_off($string);
> +    my $uri = URI->new($string);

Shouldn't uri be escaped and contain only ASCII? I see this masking real
issue.

>     my ($content, $filename, $mimetype, $encoding);
>
>     $RT::Logger->debug("Getting resource $uri");
>
> commit c6fb9f54c37142df0089145c12ab4feab52d7d27
> Author: sunnavy <sunnavy at bestpractical.com>
> Date:   Mon Aug 8 17:31:58 2011 +0800
>
>    test for dashboard chart with umlauts
>
> diff --git a/t/mail/dashboard-chart-with-umlauts.t
b/t/mail/dashboard-chart-with-umlauts.t
> new file mode 100644
> index 0000000..cfde407
> --- /dev/null
> +++ b/t/mail/dashboard-chart-with-umlauts.t
> @@ -0,0 +1,88 @@
> +use strict;
> +use warnings;
> +
> +use RT::Test tests => 19;
> +use RT::Dashboard::Mailer;
> +use Encode;
> +
> +my $root = RT::Test->load_or_create_user( Name => 'root' );
> +
> +my ( $baseurl, $m ) = RT::Test->started_ok;
> +ok( $m->login, 'logged in' );
> +
> +RT::Test->create_ticket(
> +    Queue   => 'General',
> +    Subject => decode_utf8('test äöü'),
> +);
> +
> +my $query = "Subject LIKE 'test äöü'";
> +
> +$m->get_ok(q{/Search/Chart.html?Query=Subject LIKE 'test äöü'});
> +$m->submit_form(
> +    form_name => 'SaveSearch',
> +    fields    => {
> +        SavedSearchDescription => 'chart foo',
> +        SavedSearchOwner       => 'RT::User-' . $root->id,
> +    },
> +    button => 'SavedSearchSave',
> +);
> +
> +# first, create and populate a dashboard
> +$m->get_ok('/Dashboards/Modify.html?Create=1');
> +$m->form_name('ModifyDashboard');
> +$m->field( 'Name' => 'dashboard foo' );
> +$m->click_button( value => 'Create' );
> +
> +$m->follow_link_ok( { text => 'Content' } );
> +my $form  = $m->form_name('Dashboard-Searches-body');
> +my @input = $form->find_input('Searches-body-Available');
> +my ($dashboards_component) =
> +  map { ( $_->possible_values )[1] }
> +  grep { ( $_->value_names )[1] =~ /^Chart/ } @input;
> +$form->value( 'Searches-body-Available' => $dashboards_component );
> +$m->click_button( name => 'add' );
> +$m->content_contains('Dashboard updated');
> +
> +$m->follow_link_ok( { text => 'Subscription' } );
> +$m->form_name('SubscribeDashboard');
> +$m->field( 'Frequency' => 'daily' );
> +$m->field( 'Hour'      => '06:00' );
> +$m->click_button( name => 'Save' );
> +$m->content_contains('Subscribed to dashboard dashboard foo');
> +
> +$m->follow_link_ok( { text => 'Show' } );
> +my ($src) = $m->content =~ qr{src="(/Search/Chart\?.*?)"};
> +ok( $src, 'have chart image' );
> +my $c     = $m->get($src);
> +my $image = $c->content;
> +
> +RT::Dashboard::Mailer->MailDashboards( All => 1 );
> +
> +my @mails = RT::Test->fetch_caught_mails;
> +is @mails, 1, "got a dashboard mail";
> +
> +# can't use parse_mail here is because it deletes all attachments
> +# before we can call bodyhandle :/
> +use RT::EmailParser;
> +my $parser = RT::EmailParser->new;
> +$parser->ParseMIMEEntityFromScalar( $mails[0] );
> +my $mail = $parser->ParseMIMEEntityFromScalar( $mails[0] );
> +like(
> +    $mail->head->get('Subject'),
> +    qr/Daily Dashboard: dashboard foo/,
> +    'mail subject'
> +);
> +
> +my ($mail_image) = grep { $_->mime_type eq 'image/png' } $mail->parts;
> +ok( $mail_image, 'mail contains image attachment' );
> +
> +my $handle = $mail_image->bodyhandle;
> +
> +my $mail_image_data = '';
> +if ( my $io = $handle->open('r') ) {
> +    while ( defined( $_ = $io->getline ) ) { $mail_image_data .= $_ }
> +    $io->close;
> +}
> +
> +is( $mail_image_data, $image, 'image in mail is the same one in web' );
> +
>
> -----------------------------------------------------------------------
>
> _______________________________________________
> Rt-commit mailing list
> Rt-commit at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20110808/a7b5b6bc/attachment.html>


More information about the rt-devel mailing list