Hi all!
Finally got around to replacing old calls to the deprecated SpaceManager.getSpace
with SpaceService
, and all is OK apart from one thing.
SpaceManager
seemed to find the space no matter what case the provided key was in, but SpaceService
only seems to successfully find the space if the provided key exactly matches.
As an example, an atlas-debug
dev instance starts with the “Demonstration Space” with key ds
.
SpaceManager.getSpace("DS")
would happily return that space, but SpaceService.find().withKeys("DS").fetch()
does not.
It gets trickier again even when considering users can create spaces with keys that have mixed case. For example I can create a space with key “SpOnGeBoB”.
SpaceManager.getSpace("SPONGEBOB")
, SpaceManager.getSpace("spongebob")
, SpaceManager.getSpace("SPONGEbob")
… etc etc all work fine.
But using SpaceService
it only locates the space when given the exact right case “SpOnGeBoB”.
I do understand this change, but I am also a bit puzzled since users are prevented from ever creating spaces with duplicate space keys, even if the case is different. I thought removing the deprecated SpaceManager
calls would be a breeze, but it seems we have in the past made some unfortunate assumptions and disregarded the case of space keys when storing them, so it becomes tricky to use SpaceService
here now.
It would not be too hard to attempt to fetch a space with key DS
first, then try all lowercase ds
again, but as I mentioned the case needs to match exactly, so there are possible cases where we cannot simply guess what the true space key is.
Has anyone else encountered this, or have any ideas to get around it? Or am I stuck still using SpaceManager
forevermore?