Summary: App Names can contain special characters. Escape them (and unescape later) so that device ID strings don't break. Simpler is better - thanks to mweststrate for keeping me out of the rabbit hole ## Changelog Escape app name to account for special characters in name Pull Request resolved: https://github.com/facebook/flipper/pull/1268 Test Plan: Added test to test character escaping: `cd desktop && yarn test -- -i app/src/utils/__tests__/clientUtils.node.tsx` closes https://github.com/facebook/flipper/issues/1252 Reviewed By: passy Differential Revision: D22066263 Pulled By: jknoxville fbshipit-source-id: c820d055700ca6f55d35265528ce874eeb159216
This commit is contained in:
committed by
Facebook GitHub Bot
parent
96645a21b1
commit
fec52a3989
@@ -48,3 +48,21 @@ test('client id deconstruction error logged', () => {
|
||||
});
|
||||
expect(consoleErrorSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('special characters in app name handled correctly', () => {
|
||||
const consoleErrorSpy = jest.spyOn(global.console, 'error');
|
||||
|
||||
const testClient = {
|
||||
app: '#myGreat#App&',
|
||||
os: 'iOS',
|
||||
device: 'iPhone Simulator',
|
||||
device_id: 'EC431B79-69F1-4705-9FE5-9AE5D96378E1',
|
||||
};
|
||||
const clientId = buildClientId(testClient);
|
||||
|
||||
const deconstructedClientId = deconstructClientId(clientId);
|
||||
|
||||
expect(deconstructedClientId).toStrictEqual(testClient);
|
||||
|
||||
expect(consoleErrorSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user