Skip to content
Snippets Groups Projects
Commit 9572e2ab authored by Julien Banken's avatar Julien Banken
Browse files

[FIX] slides: Verifying the returned value of re.search before accessing the capture groups.

The `search` function of the `re` package can return `None` if the
provided string does not match with the provided pattern
(https://docs.python.org/3/library/re.html#re.Pattern.search

).

On the `_parse_youtube_document` function of the `slide.slide` model,
we are directly accessing the capture groups from the returned value
of the `search` function without checking that the returned value is
actually a 'match' object. As a result, an exception can be throw if
there is no match as, in that case, the `search` function will return
`None` and the `group` function will not be defined on `None`.

To avoid throwing an exception, we will check that the returned value
of the `search` function is not `None` before accessing the capture
groups via the `group` function.

LINKS

Task id: 2525007

closes odoo/odoo#70743

X-original-commit: 575a5244
Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
parent 5ea2fcbe
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment