Address issue with links for Google Sites connector

This commit is contained in:
Weves
2023-11-02 21:48:55 -07:00
committed by Chris Weaver
parent b0f76b97ef
commit 329824ab22

View File

@@ -1,4 +1,5 @@
import os
import re
import urllib.parse
from typing import Any
from typing import cast
@@ -29,7 +30,9 @@ def process_link(element: BeautifulSoup | Tag) -> str:
href = urllib.parse.unquote(href)
href = href.rstrip(".html").lower()
href = href.replace("_", "")
href = href.replace(" ", "-")
href = re.sub(
r"([\s-]+)", "-", href
) # replace all whitespace/'-' groups with a single '-'
return href