Reimplement ShortenToken

The main goal of this change is to add support for handling partition prefixes in the token. Partition prefixes are specified by the regex, t[123]_.

While I was here, noticed some inconsistencies in the original method:

  • for tokens with a gl*- prefix, we return a 9 char short token
  • for with no prefix, we return an 8 char short token
  • for tokens with a GR prefix followed by an 8 char rotation date, we return a 17 char token.

Also, in a conversation with @pedropombeiro, I discovered that registration tokens should no longer be passed to this function.

So, I sought to rewrite this function to clean it up and to ensure that it always returns a short token of the same length. As a result the generated short tokens will change as follows:

  • tokens without a prefix will now be one character longer
  • for tokens with a partition component/prefix, that component/prefix will be removed.
  • for registration tokens, the GR and rotation date prefix will be removed. The resulting short token will be 8 characters shorter (from 17 to 9), but will have one more unique/non-prefix character. I kept this out of cautiousness even though they are not supposed to appear here anymore.

I'm sure this will not break anything ( ͡° ͜ʖ ͡°)

Fixes Runner ID displays partition prefix (#38653 - closed)

Edited by Axel von Bertoldi

Merge request reports

Loading