Skip to content

🐛 FIX: Reject url_schemes classes that aren't a list of str - #1230

Open
abhishekcpp007 wants to merge 1 commit into
executablebooks:masterfrom
abhishekcpp007:fix/url-schemes-classes-validation
Open

abhishekcpp007 wants to merge 1 commit into
executablebooks:masterfrom
abhishekcpp007:fix/url-schemes-classes-validation

Conversation

@abhishekcpp007

Copy link
Copy Markdown

The classes check in check_url_schemes joins its two conditions with and, so it only fires when the value is not a list and has a non-string item. That never happens in practice:

  • "classes": "external-gh" passes, and the link renders as class="e x t e r n a l - g h"
  • "classes": [1, 2] passes, then the HTML writer crashes with AttributeError: 'int' object has no attribute 'startswith'

Switched it to or. Added a parametrized test in TestUrlSchemes for a string, a list with an int, and a bare int, through both MdParserConfig and the topmatter merge, plus one that a list of str still passes.

This branch has not been deployed

No deployments
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.

1 participant