diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/AdminPanel/Rpmdragora/formatting.pm | 20 | ||||
| -rw-r--r-- | lib/AdminPanel/Rpmdragora/gui.pm | 4 | 
2 files changed, 14 insertions, 10 deletions
| diff --git a/lib/AdminPanel/Rpmdragora/formatting.pm b/lib/AdminPanel/Rpmdragora/formatting.pm index b4844556..c096c5f4 100644 --- a/lib/AdminPanel/Rpmdragora/formatting.pm +++ b/lib/AdminPanel/Rpmdragora/formatting.pm @@ -58,6 +58,8 @@ my $loc = AdminPanel::rpmdragora::locale();  sub escape_text_for_TextView_markup_format {      my ($str) = @_; +    return '?-?-?' unless ref $str; +      my %rules = ('&' => '&',                   '<' => '<',                   '>' => '>', @@ -71,20 +73,22 @@ sub escape_text_for_TextView_markup_format {  # from rpmtools, #37482:  sub ensure_utf8 { -    if (utf8::is_utf8($_[0])) { -	utf8::valid($_[0]) and return; +    return '?-?-?' unless ref $_[0]; -	utf8::encode($_[0]); #- disable utf8 flag -	utf8::upgrade($_[0]); +    if (utf8::is_utf8($_[0])) { +        utf8::valid($_[0]) and return; +        utf8::encode($_[0]); #- disable utf8 flag +        utf8::upgrade($_[0]);      } else { -	utf8::decode($_[0]); #- try to set utf8 flag -	utf8::valid($_[0]) and return; -	warn "do not know what to with $_[0]\n"; +        utf8::decode($_[0]); #- try to set utf8 flag +        utf8::valid($_[0]) and return; +        warn "do not know what to with $_[0]\n";      }  }  sub rpm_description {      my ($description) = @_; +    return '?-?-?' unless ref $description;      ensure_utf8($description);      my $t   = ""; @@ -166,7 +170,7 @@ sub format_changelog_changelogs {  sub format_update_field {      my ($name) = @_; -    '<i>' . eval { escape_text_for_TextView_markup_format($name) } . '</i>'; +    '<i>' . escape_text_for_TextView_markup_format($name) . '</i>';  }  sub format_name_n_summary { diff --git a/lib/AdminPanel/Rpmdragora/gui.pm b/lib/AdminPanel/Rpmdragora/gui.pm index 6fe64dc0..926783b9 100644 --- a/lib/AdminPanel/Rpmdragora/gui.pm +++ b/lib/AdminPanel/Rpmdragora/gui.pm @@ -194,7 +194,7 @@ sub get_main_text {      my ($medium, $fullname, $name, $summary, $is_update, $update_descr) = @_;      my $txt = get_string_from_keywords($medium, $fullname); -    my $notice = MDK::Common::Func::if_($txt, format_field($loc->N("Notice: ")) . $txt . "\n"); +    my $notice = MDK::Common::Func::if_($txt, format_field($loc->N("Notice: ")) . $txt . "\n") || "";      ensure_utf8($notice);      my $hdr = format_header(join(' - ', $name, $summary)) . "\n"; @@ -203,7 +203,7 @@ sub get_main_text {      my $update = MDK::Common::Func::if_($is_update, # is it an update?          format_field($loc->N("Importance: ")) . format_update_field($update_descr->{importance}) . "\n",          format_field($loc->N("Reason for update: ")) . format_update_field(rpm_description($update_descr->{pre})) . "\n", -    ); +    ) || "";      ensure_utf8($update);      # TODO Too many lines | 
