terminusdb
terminusdb copied to clipboard
id of document with no key strategy was allowed to be set to something containing a '/'
This came up during the stargazer example project. Through the python client, a Repository object (which has no key strategy) was inserted with id 'terminusdb:///data/Repository/terminusdb/terminusdb'. It seems odd to me that a '/' was allowed in the id, as this usually denotes an object hierarchy. Shouldn't we have enforced this to be escaped?
To reproduce:
#!/bin/bash
set -ex
HOST='http://admin:root@localhost:6363'
# Create database
xh DELETE "$HOST/api/db/admin/tdb" label=l comment=c
xh "$HOST/api/db/admin/tdb" label=l comment=c
# Create schema
xh "$HOST/api/document/admin/tdb" graph_type==schema author==a message==m <<EOF
{"@id":"X","@type":"Class"}
EOF
# Insert instance
xh "$HOST/api/document/admin/tdb" author==a message==m <<EOF
{"@type":"X","@id":"X/with/more/slash"}
EOF
# Get instance
xh "$HOST/api/document/admin/tdb"
Output from last two commands:
[
"terminusdb:///data/X/with/more/slash"
]
{
"@id": "X/with/more/slash",
"@type": "X"
}
We could use https://github.com/terminusdb/terminusdb/issues/747 for migrating existing documents.