Merge pull request #10 from dmo60/fix-multiline-pw
Only copy first line of multi-line password store entries
This commit is contained in:
commit
864c905e26
@ -104,14 +104,14 @@ class SearchPassService(dbus.service.Object):
|
|||||||
limit=5)]
|
limit=5)]
|
||||||
|
|
||||||
def send_password_to_gpaste(self, name):
|
def send_password_to_gpaste(self, name):
|
||||||
pass_cmd = subprocess.run(
|
try:
|
||||||
['pass', 'show', name],
|
pass_output = subprocess.check_output(
|
||||||
stdout=subprocess.PIPE,
|
['pass', 'show', name],
|
||||||
stderr=subprocess.PIPE
|
stderr=subprocess.STDOUT,
|
||||||
)
|
text=True
|
||||||
password = re.sub(b'\n$', b'', pass_cmd.stdout)
|
)
|
||||||
error = re.sub(b'\n$', b'', pass_cmd.stderr)
|
password = pass_output.split('\n', 1)[0]
|
||||||
if not pass_cmd.returncode:
|
|
||||||
self.session_bus.get_object(
|
self.session_bus.get_object(
|
||||||
'org.gnome.GPaste.Daemon',
|
'org.gnome.GPaste.Daemon',
|
||||||
'/org/gnome/GPaste'
|
'/org/gnome/GPaste'
|
||||||
@ -121,8 +121,9 @@ class SearchPassService(dbus.service.Object):
|
|||||||
dbus_interface='org.gnome.GPaste1'
|
dbus_interface='org.gnome.GPaste1'
|
||||||
)
|
)
|
||||||
self.notify('Password {} copied to clipboard.'.format(name))
|
self.notify('Password {} copied to clipboard.'.format(name))
|
||||||
else:
|
|
||||||
self.notify('Failed to copy password', body=error, error=True)
|
except subprocess.CalledProcessError as error:
|
||||||
|
self.notify('Failed to copy password!', body=error.output, error=True)
|
||||||
|
|
||||||
def send_password_to_native_clipboard(self, name):
|
def send_password_to_native_clipboard(self, name):
|
||||||
pass_cmd = subprocess.run(['pass', 'show', '-c', name])
|
pass_cmd = subprocess.run(['pass', 'show', '-c', name])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user