diff --git a/mesht_device.py b/mesht_device.py index 2ac1b66..56aabdc 100644 --- a/mesht_device.py +++ b/mesht_device.py @@ -265,7 +265,11 @@ class MeshtDevice: async def recv(self): data = await self.transport.recv() - fr = pb.decode(data, FROMRADIO_SCHEMA) + try: + fr = pb.decode(data, FROMRADIO_SCHEMA) + except UnicodeDecodeError: + logger.error("Cannot decode msg with string") + fr = {} logger.debug(f"FromRadio: {fr}") self._maybe_store_channel(fr) self._maybe_store_lora_config(fr) diff --git a/webExtensions/publicEndpoints.py b/webExtensions/publicEndpoints.py index b676ac4..975ab27 100644 --- a/webExtensions/publicEndpoints.py +++ b/webExtensions/publicEndpoints.py @@ -70,7 +70,7 @@ class WebExtension: headers = { "Cache-Control": f"public, max-age={86400*7}" } - return Response(content=img, media_type="image/png") + return Response(content=img, headers=headers, media_type="image/png") except: traceback.print_exc() raise HTTPException(status_code=404, detail="not found tile") \ No newline at end of file