<p></p>
<p>Regards, Ruslan. From phone.<br>
08.08.2011 14:01 пользователь "? sunnavy" <<a href="mailto:sunnavy@bestpractical.com">sunnavy@bestpractical.com</a>> написал:<br>
><br>
> The branch, 4.0/dashboard-chart-with-umlauts has been created<br>
> at c6fb9f54c37142df0089145c12ab4feab52d7d27 (commit)<br>
><br>
> - Log -----------------------------------------------------------------<br>
> commit c0ec1787729093b2064a36c9ef5cce5e84b763d5<br>
> Author: sunnavy <<a href="mailto:sunnavy@bestpractical.com">sunnavy@bestpractical.com</a>><br>
> Date: Mon Aug 8 17:31:41 2011 +0800<br>
><br>
> turn off utf8 as uri string is utf8 encoded, see also #18104<br>
><br>
> diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm<br>
> index f6b1685..ae10d21 100644<br>
> --- a/lib/RT/Dashboard/Mailer.pm<br>
> +++ b/lib/RT/Dashboard/Mailer.pm<br>
> @@ -476,7 +476,9 @@ sub BuildEmail {<br>
> }<br>
><br>
> sub GetResource {<br>
> - my $uri = URI->new(shift);<br>
> + my $string = shift;<br>
> + Encode::_utf8_off($string);<br>
> + my $uri = URI->new($string);</p>
<p>Shouldn't uri be escaped and contain only ASCII? I see this masking real issue.<br><br></p>
<p>> my ($content, $filename, $mimetype, $encoding);<br>
><br>
> $RT::Logger->debug("Getting resource $uri");<br>
><br>
> commit c6fb9f54c37142df0089145c12ab4feab52d7d27<br>
> Author: sunnavy <<a href="mailto:sunnavy@bestpractical.com">sunnavy@bestpractical.com</a>><br>
> Date: Mon Aug 8 17:31:58 2011 +0800<br>
><br>
> test for dashboard chart with umlauts<br>
><br>
> diff --git a/t/mail/dashboard-chart-with-umlauts.t b/t/mail/dashboard-chart-with-umlauts.t<br>
> new file mode 100644<br>
> index 0000000..cfde407<br>
> --- /dev/null<br>
> +++ b/t/mail/dashboard-chart-with-umlauts.t<br>
> @@ -0,0 +1,88 @@<br>
> +use strict;<br>
> +use warnings;<br>
> +<br>
> +use RT::Test tests => 19;<br>
> +use RT::Dashboard::Mailer;<br>
> +use Encode;<br>
> +<br>
> +my $root = RT::Test->load_or_create_user( Name => 'root' );<br>
> +<br>
> +my ( $baseurl, $m ) = RT::Test->started_ok;<br>
> +ok( $m->login, 'logged in' );<br>
> +<br>
> +RT::Test->create_ticket(<br>
> + Queue => 'General',<br>
> + Subject => decode_utf8('test äöü'),<br>
> +);<br>
> +<br>
> +my $query = "Subject LIKE 'test äöü'";<br>
> +<br>
> +$m->get_ok(q{/Search/Chart.html?Query=Subject LIKE 'test äöü'});<br>
> +$m->submit_form(<br>
> + form_name => 'SaveSearch',<br>
> + fields => {<br>
> + SavedSearchDescription => 'chart foo',<br>
> + SavedSearchOwner => 'RT::User-' . $root->id,<br>
> + },<br>
> + button => 'SavedSearchSave',<br>
> +);<br>
> +<br>
> +# first, create and populate a dashboard<br>
> +$m->get_ok('/Dashboards/Modify.html?Create=1');<br>
> +$m->form_name('ModifyDashboard');<br>
> +$m->field( 'Name' => 'dashboard foo' );<br>
> +$m->click_button( value => 'Create' );<br>
> +<br>
> +$m->follow_link_ok( { text => 'Content' } );<br>
> +my $form = $m->form_name('Dashboard-Searches-body');<br>
> +my @input = $form->find_input('Searches-body-Available');<br>
> +my ($dashboards_component) =<br>
> + map { ( $_->possible_values )[1] }<br>
> + grep { ( $_->value_names )[1] =~ /^Chart/ } @input;<br>
> +$form->value( 'Searches-body-Available' => $dashboards_component );<br>
> +$m->click_button( name => 'add' );<br>
> +$m->content_contains('Dashboard updated');<br>
> +<br>
> +$m->follow_link_ok( { text => 'Subscription' } );<br>
> +$m->form_name('SubscribeDashboard');<br>
> +$m->field( 'Frequency' => 'daily' );<br>
> +$m->field( 'Hour' => '06:00' );<br>
> +$m->click_button( name => 'Save' );<br>
> +$m->content_contains('Subscribed to dashboard dashboard foo');<br>
> +<br>
> +$m->follow_link_ok( { text => 'Show' } );<br>
> +my ($src) = $m->content =~ qr{src="(/Search/Chart\?.*?)"};<br>
> +ok( $src, 'have chart image' );<br>
> +my $c = $m->get($src);<br>
> +my $image = $c->content;<br>
> +<br>
> +RT::Dashboard::Mailer->MailDashboards( All => 1 );<br>
> +<br>
> +my @mails = RT::Test->fetch_caught_mails;<br>
> +is @mails, 1, "got a dashboard mail";<br>
> +<br>
> +# can't use parse_mail here is because it deletes all attachments<br>
> +# before we can call bodyhandle :/<br>
> +use RT::EmailParser;<br>
> +my $parser = RT::EmailParser->new;<br>
> +$parser->ParseMIMEEntityFromScalar( $mails[0] );<br>
> +my $mail = $parser->ParseMIMEEntityFromScalar( $mails[0] );<br>
> +like(<br>
> + $mail->head->get('Subject'),<br>
> + qr/Daily Dashboard: dashboard foo/,<br>
> + 'mail subject'<br>
> +);<br>
> +<br>
> +my ($mail_image) = grep { $_->mime_type eq 'image/png' } $mail->parts;<br>
> +ok( $mail_image, 'mail contains image attachment' );<br>
> +<br>
> +my $handle = $mail_image->bodyhandle;<br>
> +<br>
> +my $mail_image_data = '';<br>
> +if ( my $io = $handle->open('r') ) {<br>
> + while ( defined( $_ = $io->getline ) ) { $mail_image_data .= $_ }<br>
> + $io->close;<br>
> +}<br>
> +<br>
> +is( $mail_image_data, $image, 'image in mail is the same one in web' );<br>
> +<br>
><br>
> -----------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Rt-commit mailing list<br>
> <a href="mailto:Rt-commit@lists.bestpractical.com">Rt-commit@lists.bestpractical.com</a><br>
> <a href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit</a><br>
><br>
</p>