Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 067f96cc authored by faquin's avatar faquin
Browse files

Escape regex

Because we are building regex from random strings, we need to escape
them.
parent a0b50e77
......@@ -41,22 +41,22 @@ class RunningCommand:
return -1
def get_stdout_regex(self):
regex = "^.*{}-{}: {} \(.*\): output >.*".format(self.name, self.dest,
self.command)
logger.debug("regex -> ^.*{}-{}: {} \(.*\):"
" output >.*".format(self.name, self.dest, self.command))
regex = "^.*{}-{}: {} \(.*\): output >.*".format(re.escape(self.name),
re.escape(self.dest), re.escape(self.command))
logger.debug("regex -> ^.*{}-{}: {} \(.*\):" " output >.*".format(re.escape(self.name),
re.escape(self.dest), re.escape(self.command)))
return re.compile(regex)
def get_stderr_regex(self):
regex = "^.*{}-{}: {} \(.*\): error >.*".format(self.name, self.dest,
self.command)
regex = "^.*{}-{}: {} \(.*\): error >.*".format(re.escape(self.name),
re.escape(self.dest), re.escape(self.command))
logger.debug("regex -> ^.*{}-{}: {} \(.*\):"
" error >.*".format(self.name, self.dest, self.command))
return re.compile(regex)
def get_final_regex(self):
regex = "^.*{}-{}: {} \(.*\): status >.*".format(self.name, self.dest,
self.command)
regex = "^.*{}-{}: {} \(.*\): status >.*".format(re.escape(self.name),
re.escape(self.dest), re.escape(self.command))
logger.debug("regex -> ^.*{}-{}: {} \(.*\):"
" status >.*".format(self.name, self.dest, self.command))
return re.compile(regex)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment