Skip to content

Handling non-data urls appropriately #10

@NBIX-Mark-Southern

Description

@NBIX-Mark-Southern

Potentially return None in the case of an invalid data url. Would require refactoring of __parse_url where DATA_URL_RE does not match.

from data_url import DataURL

if url := DataURL.from_url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...")
    # is a data url so work with it.
else:
    pass

Or implement def __bool__(self) and return False when there is no match.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions