Detect unexpected root page redirects and abort operation

This commit is contained in:
I-Al-Istannen
2023-06-02 18:19:39 +02:00
parent 443f7fe839
commit d204dac8ce
3 changed files with 27 additions and 4 deletions

View File

@ -79,6 +79,16 @@ class IliasPage:
self._page_type = source_element.type if source_element else None
self._source_name = source_element.name if source_element else ""
@staticmethod
def is_root_page(soup: BeautifulSoup) -> bool:
permalink = soup.find(id="current_perma_link")
if permalink is None:
return False
value = permalink.attrs.get("value")
if value is None:
return False
return "goto.php?target=root_" in value
def get_child_elements(self) -> List[IliasPageElement]:
"""
Return all child page elements you can find here.