fix: Remove URL encoding from base64 strings before decoding

This commit is contained in:
Joachim Van Herwegen
2023-10-03 11:19:47 +02:00
parent 4f095243df
commit d31393f475
2 changed files with 25 additions and 1 deletions

View File

@@ -48,4 +48,20 @@ describe('An EncodingPathStorage', (): void => {
expect(results).toHaveLength(1);
expect(results[0]).toEqual([ 'key', data ]);
});
it('correctly handles keys that have been encoded by the source storage.', async(): Promise<void> => {
// Base 64 encoding of 'apple'
const encodedKey = 'YXBwbGU=';
const generatedPath = `${relativePath}${encodeURIComponent(encodedKey)}`;
const data = 'data';
map.set(generatedPath, data);
const results = [];
for await (const entry of storage.entries()) {
results.push(entry);
}
expect(results).toHaveLength(1);
expect(results[0]).toEqual([ 'apple', data ]);
});
});