Skip to content

Commit

Permalink
protect for error when entering invalid file name as input
Browse files Browse the repository at this point in the history
  • Loading branch information
roznet committed Oct 2, 2021
1 parent 523e2a5 commit e137a9d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions bin/remotestash
Original file line number Diff line number Diff line change
Expand Up @@ -821,19 +821,24 @@ class RemoteStash:
listener = RemoteStashClient(path,self)
if path == 'push':
(filename,inputf) = self.get_input_file()
listener.filename = filename
listener.content = inputf.read()
listener.outfile = None
if inputf:
listener.filename = filename
listener.content = inputf.read()
listener.outfile = None
else:
print( "Failed to open input file" )
listener = None
else:
listener.filename = None
listener.content = None
listener.outfile = None

listener.content_type = self.get_input_content_type()
browser = ServiceBrowser(zeroconf, "_remotestash._tcp.local.", listener)
time.sleep(self.args.timeout)
if path != 'list':
print( 'Failed to find a stash on the local network' )

if listener:
listener.content_type = self.get_input_content_type()
browser = ServiceBrowser(zeroconf, "_remotestash._tcp.local.", listener)
time.sleep(self.args.timeout)
if path != 'list':
print( 'Failed to find a stash on the local network' )

def cmd_serve(self):
'''
Expand Down

0 comments on commit e137a9d

Please sign in to comment.