Skip to content

fix: search only for valid attachment links in Confluence page #535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 11, 2025

Conversation

ds-filipknefel
Copy link
Contributor

Modify the HtmlMixin to allow for customized hyperlink tag search in subclasses using the mixin by overwriting a dedicated method.
Overwrite said method in the ConfluenceDownloaderConfig to target only embedded attachment files when running with extract_files flag.

def _find_hyperlink_tags(self, html_soup: "BeautifulSoup") -> list["Tag"]:
"""Find hyperlink tags in the HTML.

Overwrite this method to customize the tag search.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively I'm thinking this method could be extended instead of overwritten, such that in subclass you'd do the following - however this means you can't use a customized query which you might want to.

tags = super()._find_hyperlink_tags(html_soup)
return [tag for tag in tags if subclass_predicate(tag)]

@ds-filipknefel ds-filipknefel marked this pull request as ready for review June 10, 2025 11:55
Copy link
Contributor

@mpolomdeepsense mpolomdeepsense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ds-filipknefel ds-filipknefel merged commit b5d3268 into main Jun 11, 2025
33 of 36 checks passed
@ds-filipknefel ds-filipknefel deleted the fix/confluence-attachments branch June 11, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants