Skip to content

Make Key.toUrlSafe() consistent with the URL-safe key displayed in Google Cloud Datastore Console #1357

Description

@sai-pullabhotla

The Key.toUrlSafe() returns a URL encoded (similar to URLEncoder.encode) version of the key like the one below:

partition_id+%7B%0A++project_id%3A+%22my-project%22%0A++namespace_id%3A+%22MyNamespace%22%0A%7D%0Apath+%7B%0A++kind%3A+%22MyEntity%22%0A++name%3A+%22MyKey%22%0A%7D%0A

The Google Cloud Datastore Console displays a Base64 encoded version of the key, which looks something like -

agVoZWxsb3IPCxIHQWNjb3VudBiZiwIM

The Console allows filtering on key by URL-safe key, which works fine if I use the URL-safe value displayed by the GCD Console, but does not work when using the value returned from Key.toUrlSafe().

The Console Documentation states that -

URL-safe key

This is a base64-encoded, serialized version of your entity key. The encoding method is available in any Cloud Datastore client library

Example: agVoZWxsb3IPCxIHQWNjb3VudBiZiwIM

So, the client libraries are expected to match with the Base64 version? Nonetheless, it would be nice to have the client libraries and Console in sync to help with crosschecking/debugging purposes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: datastoreIssues related to the Datastore API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions