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

Bugfix: compiler asset type fix #27

Merged
merged 4 commits into from
Jul 29, 2024
Merged

Conversation

OscarLuu
Copy link
Member

@OscarLuu OscarLuu commented Jul 24, 2024

Due to the python2 -> python3 migrations, data uri's need to have the proper typing to be able to reference assets correctly.

Base64 encoding returns bytestrings which then are referenced in data_uri's that look like this:

url(data:image/svg+xml;base64,b'SIgeG1sbnM9Imh0')
>>> encoded = base64.b64encode(open('sample.svg', 'rb').read())
>>> encoded
b'D0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLz'

In order to fix this, we should decode the byte string into string to allow the proper decoding of the data_uri.

>>> encoded = base64.b64encode(open('sample.svg', 'rb').read()).decode('utf-8')
>>> encoded
'D0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLz'

This PR also addresses testing and ensuring github actions testing works properly and as intended

Comment on lines +29 to +30
sass_compiler=opts.get("sass_compiler", None),
lessc_path=opts.get("lessc_path", None), # less is unused
Copy link
Member

Choose a reason for hiding this comment

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

None is the default value from .get and can be removed.

@jehiah jehiah merged commit ccc8d3f into bitly:master Jul 29, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants