Skip to content
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

Fix regex to exclude Wikipedia links to image file pages #156

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

vongrad
Copy link
Contributor

@vongrad vongrad commented Mar 4, 2023

The regex to exclude the Wikipedia links does not always work as if you visit a page in a different language, i.e. Danish, the link will look differently:
https://da.m.wikipedia.org/wiki/Fil:Danmark-locator.png

This will break the images when using the --inline cli option as it will instead try to base64 encode contents of https://da.m.wikipedia.org/wiki/Fil:Danmark-locator.png, which is an HTML page.

I propose that we change the regex as shown in the commit to take into account different languages.

@danburzo
Copy link
Owner

danburzo commented Mar 6, 2023

That's a good idea! I wonder if we should extend the regex to something like /wikipedia\.org\/wiki\/[a-z]+:/i to make sure we're not too general with the exclusion rule?

@vongrad
Copy link
Contributor Author

vongrad commented Mar 7, 2023

Agreed, shall I change it in the commit?

@danburzo
Copy link
Owner

danburzo commented Mar 7, 2023

That would be great, if you don't mind!

@vongrad
Copy link
Contributor Author

vongrad commented Mar 7, 2023

Fixed, please review.

@danburzo
Copy link
Owner

danburzo commented Mar 7, 2023

Awesome, thank you!

@danburzo danburzo merged commit 44386ef into danburzo:main Mar 7, 2023
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.

None yet

2 participants