manatools / dnfdragora

dnfdragora is a dnf frontend based on libyui abstraction
GNU General Public License v3.0
137 stars 41 forks source link

'Update information' crash dnfdragora #217

Closed L-U-T-i closed 10 months ago

L-U-T-i commented 1 year ago

Clicking 'Update information' for a package (where update information is available) causes (quite misleading)

dnfdaemon attribute error occured:
'tuple' object has no attribute 'replace'

error / crash.

The actual culprit is the line 1115: s += '<b>%s</b> %s'%(pkg.updateinfo[0]['id'], escape(pkg.updateinfo[0]['updated'])).replace("\n", "<br>")

which should probably be: s += '<b>%s</b> %s'%(pkg.updateinfo[0]['id'], escape(pkg.updateinfo[0]['updated']).replace("\n", "<br>"))

This modification fixes the issue for me at least.

At the same time, I've added also some <br> lines to keep the spacing between the sections as when not clicked, getting the final patch:

diff -up a/dnfdragora/ui.py b/dnfdragora/ui.py
--- a/dnfdragora/ui.py  2023-04-08 08:13:32.000000000 +0200
+++ b/dnfdragora/ui.py  2023-07-18 02:02:22.957365425 +0200
@@ -1112,9 +1112,10 @@ class mainGui(dnfdragora.basedragora.Bas
                         s += "<br>"
                         s += escape(pkg.updateinfo[0]['description']).replace("\n", "<br>")
                         s += "<br>"
-                        s += '<b>%s</b> %s'%(pkg.updateinfo[0]['id'], escape(pkg.updateinfo[0]['updated'])).replace("\n", "<br>")
+                        s += '<b>%s</b> %s'%(pkg.updateinfo[0]['id'], escape(pkg.updateinfo[0]['updated']).replace("\n", "<br>"))
                     else :
                         s+= missing
+                    s += "<br>"

             if pkg.repository:
                 s += "<br>"
@@ -1135,6 +1136,7 @@ class mainGui(dnfdragora.basedragora.Bas
                     s+= "<br>".join(pkg.requirements)
                 else:
                     s+= missing
+                s += "<br>"

             t = 'files'
             s += "<br>"
@@ -1145,6 +1147,7 @@ class mainGui(dnfdragora.basedragora.Bas
                     s+= "<br>".join(pkg.filelist)
                 else:
                     s+= missing
+                s += "<br>"

             t = 'changelog'
             s += "<br>"
@@ -1155,6 +1158,7 @@ class mainGui(dnfdragora.basedragora.Bas
                     s+= "<br>".join(pkg.changelog)
                 else:
                     s+= missing
+                s += "<br>"
             self.info.setValue(s)
         else:
           logger.warning("_setInfoOnWidget without package")
anaselli commented 1 year ago

Your patch sounds good to me. Can you provide a PR for this?

L-U-T-i commented 1 year ago

I've never done anything like that, and also don't know what to do or how to do it. I am browsing github through a web browser only. Can you do it, please?

rkraats commented 10 months ago

@anaselli , could you please apply @L-U-T-i 's patch? That would also help closing https://bugzilla.redhat.com/show_bug.cgi?id=2237265 . Thanks!

anaselli commented 10 months ago

dnfdragora 2.1.6 has been released.