Skip to content

Commit

Permalink
[ENH]: use name/uuid to get collection (#2040)
Browse files Browse the repository at this point in the history
## Description of changes

*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
	 - Use only name to get collection
  • Loading branch information
nicolasgere committed Apr 22, 2024
1 parent ce5c6b3 commit e5ec1b3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions chromadb/server/fastapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from chromadb.errors import (
ChromaError,
InvalidDimensionException,
InvalidHTTPVersion,
InvalidHTTPVersion, InvalidUUIDError,
)
from chromadb.quota import QuotaError
from chromadb.rate_limiting import RateLimitError
Expand Down Expand Up @@ -377,11 +377,16 @@ def auth_and_get_tenant_and_database_for_request(
database = new_database

if (self._system.settings.chroma_overwrite_singleton_tenant_database_access_from_auth
and collection is not None):
collec = self._api.get_collection(
id=_uuid(collection),
name=collection
)
and collection is not None and action != AuthzAction.CREATE_COLLECTION and action != AuthzAction.GET_OR_CREATE_COLLECTION):
try:
uuid = _uuid(collection)
collec = self._api.get_collection(
id=uuid,
)
except InvalidUUIDError:
collec = self._api.get_collection(
name=collection,
)
if not collec:
raise HTTPException(
status_code=404,
Expand Down

0 comments on commit e5ec1b3

Please sign in to comment.