No image found for data source causes UI bugs
Itaykal opened this issue · 0 comments
Itaykal commented
When there's no image for at least one of the data sources the UI wont load any data source.
This bug originates in app/api/data_source.py in line 33:
@staticmethod
def from_data_source_class(name: str, data_source_class: BaseDataSource) -> 'DataSourceTypeDto':
with open(f"static/data_source_icons/{name}.png", "rb") as file:
encoded_string = base64.b64encode(file.read())
image_base64 = f"data:image/png;base64,{encoded_string.decode()}"
return DataSourceTypeDto(
name=name,
display_name=data_source_class.get_display_name(),
config_fields=data_source_class.get_config_fields(),
image_base64=image_base64,
has_prerequisites=data_source_class.has_prerequisites()
)The function is lacking error handling, handle the errors and fix it.