7435: Media Editor error if Path value was changed to a non existing file

fix media path
This commit is contained in:
Josip 2014-03-08 21:53:12 +01:00
parent b868e3e256
commit b38e5996fb

View File

@ -297,8 +297,12 @@ class EditMedia(EditPrimary):
return return
path = self.file_path.get_text() path = self.file_path.get_text()
if os.path.isfile(path): ref_obj = self.dbstate.db.get_object_from_handle(self.obj.handle)
self.determine_mime() if ref_obj:
media_path = media_path_full(self.dbstate.db,
ref_obj.get_path())
if os.path.exists(os.path.join(os.path.dirname(media_path), path)):
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!")
msg2 = _("You have attempted to use the path with " msg2 = _("You have attempted to use the path with "