7712: Use full path for file existence check

This commit is contained in:
Nick Hall 2014-05-27 15:04:23 +01:00
parent d06cf9ab08
commit 58843c01b4

View File

@ -295,7 +295,8 @@ class EditMedia(EditPrimary):
return return
path = conv_to_unicode(self.file_path.get_text()) path = conv_to_unicode(self.file_path.get_text())
if os.path.isfile(path): full_path = media_path_full(self.db, path)
if os.path.isfile(full_path):
self.determine_mime() self.determine_mime()
else: else:
msg1 = _("There is no media matching the current path value!") msg1 = _("There is no media matching the current path value!")
@ -307,7 +308,7 @@ class EditMedia(EditPrimary):
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
self.obj.set_path(conv_to_unicode(path)) self.obj.set_path(path)
with DbTxn('', self.db) as trans: with DbTxn('', self.db) as trans:
if not self.obj.get_handle(): if not self.obj.get_handle():