Clean up - remove UnsupportedPathSchemeError

This commit is contained in:
Daulet Amirkhanov 2025-10-20 22:05:14 +01:00
parent 35d3c08779
commit 085e81c082
5 changed files with 0 additions and 23 deletions

View file

@ -11,15 +11,3 @@ class FileContentHashingError(Exception):
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
): ):
super().__init__(message, name, status_code) super().__init__(message, name, status_code)
class UnsupportedPathSchemeError(Exception):
"""Raised when a non-filesystem path scheme (like http://, https://) is passed to a function expecting filesystem paths."""
def __init__(
self,
message: str = "This function only supports filesystem paths (file:// or local paths), not HTTP/HTTPS URLs.",
name: str = "UnsupportedPathSchemeError",
status_code=status.HTTP_400_BAD_REQUEST,
):
super().__init__(message, name, status_code)

View file

@ -1,8 +1,6 @@
import os import os
from urllib.parse import urlparse from urllib.parse import urlparse
from cognee.infrastructure.files.exceptions import UnsupportedPathSchemeError
def get_data_file_path(file_path: str): def get_data_file_path(file_path: str):
# Check if this is a file URI BEFORE normalizing (which corrupts URIs) # Check if this is a file URI BEFORE normalizing (which corrupts URIs)
@ -40,11 +38,6 @@ def get_data_file_path(file_path: str):
return normalized_url return normalized_url
elif file_path.startswith(("http://", "https://")):
raise UnsupportedPathSchemeError(
message=f"HTTP/HTTPS URLs are not supported by get_data_file_path(). Received: {file_path}"
)
else: else:
# Regular file path - normalize separators # Regular file path - normalize separators
normalized_path = os.path.normpath(file_path) normalized_path = os.path.normpath(file_path)

View file

@ -9,7 +9,6 @@ import os
from typing import Any, Dict, AsyncGenerator, Optional from typing import Any, Dict, AsyncGenerator, Optional
from sqlalchemy import select from sqlalchemy import select
from cognee.infrastructure.files.exceptions import UnsupportedPathSchemeError
import cognee.modules.ingestion as ingestion import cognee.modules.ingestion as ingestion
from cognee.infrastructure.databases.relational import get_relational_engine from cognee.infrastructure.databases.relational import get_relational_engine
from cognee.infrastructure.files.utils.open_data_file import open_data_file from cognee.infrastructure.files.utils.open_data_file import open_data_file

View file

@ -3,8 +3,6 @@ import inspect
from uuid import UUID from uuid import UUID
from typing import Union, BinaryIO, Any, List, Optional from typing import Union, BinaryIO, Any, List, Optional
from cognee.infrastructure.files.exceptions import UnsupportedPathSchemeError
from cognee.infrastructure.loaders import LoaderInterface
import cognee.modules.ingestion as ingestion import cognee.modules.ingestion as ingestion
from cognee.infrastructure.databases.relational import get_relational_engine from cognee.infrastructure.databases.relational import get_relational_engine
from cognee.modules.data.models import Data from cognee.modules.data.models import Data

View file

@ -3,7 +3,6 @@ from pathlib import Path
from urllib.parse import urlparse from urllib.parse import urlparse
from typing import Union, BinaryIO, Any from typing import Union, BinaryIO, Any
from cognee.infrastructure.files.exceptions import UnsupportedPathSchemeError
from cognee.modules.ingestion.exceptions import IngestionError from cognee.modules.ingestion.exceptions import IngestionError
from cognee.modules.ingestion import save_data_to_file from cognee.modules.ingestion import save_data_to_file
from cognee.shared.logging_utils import get_logger from cognee.shared.logging_utils import get_logger