Commit 296b66d7 authored by Falk Alexander Seidl's avatar Falk Alexander Seidl

Fix Reference Handling

Remove the uuid transformation and instead build uuid objects out of uuid strings.
parent a3c9bc86
Pipeline #146692 failed with stage
in 19 minutes and 48 seconds
......@@ -19,7 +19,7 @@
</ul>
</description>
</release>
<release version="3.99" date="2020-01-19">
<release version="3.99" date="2020-01-19">
<description>
<p>Password Safe 3.99 brings small feature additions and bug fixes.</p>
<ul>
......
......@@ -7,6 +7,7 @@ import passwordsafe.password_generator
import passwordsafe.config_manager
import threading
import subprocess, os
import uuid as u
class EntryPage:
......@@ -715,7 +716,7 @@ class EntryPage:
if scrolled_page.password_property_value_entry.get_text().startswith("{REF:P"):
try:
password = self.unlocked_database.database_manager.get_entry_password_from_entry_uuid(self.unlocked_database.hex_to_base64(self.unlocked_database.reference_to_hex_uuid(scrolled_page.password_property_value_entry.get_text())))
password = self.unlocked_database.database_manager.get_entry_password_from_entry_uuid(u.UUID(self.unlocked_database.reference_to_hex_uuid(scrolled_page.password_property_value_entry.get_text())))
except(Exception):
password = scrolled_page.password_property_value_entry.get_text()
else:
......
......@@ -2,6 +2,7 @@ from gettext import gettext as _
from gi.repository import Gtk
import passwordsafe.config_manager
import passwordsafe.icon
import uuid as u
class EntryRow(Gtk.ListBoxRow):
......@@ -67,7 +68,7 @@ class EntryRow(Gtk.ListBoxRow):
if (self.database_manager.has_entry_username(self.entry_uuid) is True and subtitle is not ""):
username = self.database_manager.get_entry_username_from_entry_uuid(self.entry_uuid)
if username.startswith("{REF:U"):
entry_subtitle_label.set_text(self.database_manager.get_entry_username_from_entry_uuid(self.unlocked_database.hex_to_base64(self.unlocked_database.reference_to_hex_uuid(username))))
entry_subtitle_label.set_text(self.database_manager.get_entry_username_from_entry_uuid(u.UUID(self.unlocked_database.reference_to_hex_uuid(username))))
else:
entry_subtitle_label.set_text(username)
else:
......
......@@ -21,6 +21,7 @@ import passwordsafe.config_manager
import re
import time
import threading
import uuid as u
class UnlockedDatabase:
......@@ -627,7 +628,7 @@ class UnlockedDatabase:
code = ref.group()[5]
try:
uuid = self.hex_to_base64(self.reference_to_hex_uuid(ref.group()))
uuid = u.UUID(self.reference_to_hex_uuid(ref.group()))
except(Exception):
not_valid = True
......@@ -648,6 +649,7 @@ class UnlockedDatabase:
try:
value = self.database_manager.get_entry_password_from_entry_uuid(uuid)
except(AttributeError):
print("FAIL")
value = ref.group()
elif code == "A":
try:
......@@ -918,9 +920,6 @@ class UnlockedDatabase:
def reference_to_hex_uuid(self, reference_string):
return reference_string[9:-1].lower()
def hex_to_base64(self, hex_uuid):
return codecs.encode(codecs.decode(hex_uuid.encode(), 'hex'), 'base64').decode().splitlines()[0]
#
# DBus
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment