diff --git a/frontends/src/jp/cmd_blog.py b/frontends/src/jp/cmd_blog.py index 6c30a38b..fd17b0dc 100644 --- a/frontends/src/jp/cmd_blog.py +++ b/frontends/src/jp/cmd_blog.py @@ -116,6 +116,9 @@ class BlogCommon(object): """ if not os.path.isfile(path): raise OSError(u"path must link to a regular file") + if not path.startswith(self.getTmpDir(sat_conf)): + self.disp(u"File {} is not in blog temporary hierarchy, we do not remove it".format(path.decode('utf-8')), 2) + return backup_dir = self.getTmpDir(sat_conf, SECURE_UNLINK_DIR) if not os.path.exists(backup_dir): os.makedirs(backup_dir) @@ -311,6 +314,9 @@ class Edit(base.CommandBase, BlogCommon): if len(content) == 0: self.disp(u"Content is empty, cancelling the blog edition") + if not content_file_path.startswith(self.getTmpDir(sat_conf)): + self.disp(u"File are not in blog temporary hierarchy, we do not remove it", 2) + self.host.quit() self.disp(u"Deletion of {}".format(content_file_path.decode('utf-8')), 2) os.unlink(content_file_path) self.disp(u"Deletion of {}".format(meta_file_path.decode('utf-8')), 2)