Fix #2129 : Empty filename can be set in AddTorrent dialog

This commit is contained in:
Calum Lind 2012-12-05 18:10:53 +00:00
parent a5df53249a
commit eed46994da
1 changed files with 3 additions and 1 deletions

View File

@ -864,7 +864,7 @@ class AddTorrentDialog(component.Component):
def _on_filename_edited(self, renderer, path, new_text): def _on_filename_edited(self, renderer, path, new_text):
index = self.files_treestore[path][3] index = self.files_treestore[path][3]
new_text = new_text.strip(os.path.sep) new_text = new_text.strip(os.path.sep).strip()
# Return if the text hasn't changed # Return if the text hasn't changed
if new_text == self.files_treestore[path][1]: if new_text == self.files_treestore[path][1]:
@ -882,6 +882,8 @@ class AddTorrentDialog(component.Component):
if index > -1: if index > -1:
# We're renaming a file! Yay! That's easy! # We're renaming a file! Yay! That's easy!
if not new_text:
return
parent = self.files_treestore.iter_parent(itr) parent = self.files_treestore.iter_parent(itr)
file_path = os.path.join(self.get_file_path(parent), new_text) file_path = os.path.join(self.get_file_path(parent), new_text)