From 966c4dad0b32580ae258475d490dfed80a07a864 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 16 Nov 2023 13:01:35 -0300 Subject: [PATCH] Fix error handling in get_components and add missing condition in StoreService --- src/backend/langflow/api/v1/store.py | 3 +-- src/backend/langflow/services/store/service.py | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/api/v1/store.py b/src/backend/langflow/api/v1/store.py index a47529cae..3c1ddb709 100644 --- a/src/backend/langflow/api/v1/store.py +++ b/src/backend/langflow/api/v1/store.py @@ -4,7 +4,6 @@ from uuid import UUID from fastapi import APIRouter, Depends, HTTPException, Query from httpx import HTTPStatusError - from langflow.services.auth import utils as auth_utils from langflow.services.database.models.user.user import User from langflow.services.deps import get_settings_service, get_store_service @@ -173,7 +172,7 @@ async def get_components( elif isinstance(exc, ValueError): if "Check your API key" in str(exc): raise HTTPException(status_code=401, detail=str(exc)) - elif "filter by likes" in str(exc): + elif "filter by likes" in str(exc) or "filter your components" in str(exc): raise HTTPException(status_code=400, detail=str(exc)) raise HTTPException(status_code=403, detail=str(exc)) diff --git a/src/backend/langflow/services/store/service.py b/src/backend/langflow/services/store/service.py index a1f098fd7..2d4ae8582 100644 --- a/src/backend/langflow/services/store/service.py +++ b/src/backend/langflow/services/store/service.py @@ -171,6 +171,7 @@ class StoreService(Service): filter_conditions.append(liked_filter) elif liked and not store_api_Key: raise ValueError("You must provide an API key to filter by likes") + if filter_by_user and store_api_Key: user_data = user_data_var.get() if not user_data: