Generated string for keyToLegacyUrlSafe using namespace undefined vs empty string
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
-
Is this a client library issue or a product issue? Yes, i believe its a client library issue (@google-cloud/datastore)
-
Did someone already solve this? no other issues found/resolved
-
Do you have a support contract? no
If the support paths suggested above still do not result in a resolution, please provide the following details.
Environment details
- OS: Windows
- Node.js version: 18
- npm version: 9.6.7
@google-cloud/datastoreversion: 8.7.0
Steps to reproduce
There is a difference between urlSafe keys generated using the empty string as a namespace and undefined as a namespace. The empty string one has a few letters extra at the end of the string.
const datastore = new Datastore({});
let hash1 = (await datastore.keyToLegacyUrlSafe(datastore.key({namespace:undefined,path: ["Kind", "name"]}), "e~"))
let hash2 = (await datastore.keyToLegacyUrlSafe(datastore.key({namespace:"",path: ["Kind", "name"]}), "e~"))
console.log(hash1, hash2)
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!