mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fix: restore legacy /projects/projects endpoint for older CLI versions
Older versions of basic-memory CLI (v0.17.4 and earlier) call GET /projects/projects to list projects. This endpoint was removed when we migrated to v2 routers. Add explicit route at /projects/projects (without trailing slash) to avoid 307 redirects that the cloud proxy doesn't follow. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
@@ -4,6 +4,7 @@ from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from fastapi.exception_handlers import http_exception_handler
|
||||
from fastapi.routing import APIRouter
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory import __version__ as version
|
||||
@@ -18,6 +19,7 @@ from basic_memory.api.v2.routers import (
|
||||
prompt_router as v2_prompt,
|
||||
importer_router as v2_importer,
|
||||
)
|
||||
from basic_memory.api.v2.routers.project_router import list_projects
|
||||
from basic_memory.config import init_api_logging
|
||||
from basic_memory.services.initialization import initialize_app
|
||||
|
||||
@@ -82,6 +84,12 @@ app.include_router(v2_project, prefix="/v2")
|
||||
# Legacy web app proxy paths (compat with /proxy/projects/projects)
|
||||
app.include_router(v2_project, prefix="/proxy/projects")
|
||||
|
||||
# Legacy v1 compat: older CLI versions call GET /projects/projects (without trailing slash)
|
||||
# Using router mount causes 307 redirect which proxy doesn't follow, so add explicit route
|
||||
legacy_router = APIRouter(tags=["legacy"])
|
||||
legacy_router.add_api_route("/projects/projects", list_projects, methods=["GET"])
|
||||
app.include_router(legacy_router)
|
||||
|
||||
# V2 routers are the only public API surface
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user