Merge pull request #11833 from overleaf/jpa-v2-fallback

[access-token-encryptor] scripts: fallback version to v2

GitOrigin-RevId: 232e6b1f6b8667a58c5fd0f5caf604209f100809
This commit is contained in:
Jakob Ackermann 2023-02-15 13:55:33 +00:00 committed by Copybot
parent d06a578492
commit 79f7d259e9
2 changed files with 4 additions and 2 deletions

View file

@ -70,7 +70,8 @@ async function reEncryptTokensInCollection({
if (!blob) continue
// Schema: LABEL-VERSION:SALT:CIPHERTEXT:IV
const [label] = blob.split(':')
const [, version] = label.split('-')
let [, version] = label.split('-')
version = version || 'v2'
const key = [name, version, collectionName, path, label].join(':')
stats[key] = (stats[key] || 0) + 1

View file

@ -42,7 +42,8 @@ async function count(collectionName, paths) {
if (!blob) continue
// Schema: LABEL-VERSION:SALT:CIPHERTEXT:IV
const [label] = blob.split(':')
const [, version] = label.split('-')
let [, version] = label.split('-')
version = version || 'v2'
const key = [name, version, collectionName, path, label].join(':')
stats[key] = (stats[key] || 0) + 1