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
@@ -72,14 +72,16 @@ export function buildClientId(clientInfo: {
|
||||
);
|
||||
}
|
||||
}
|
||||
return `${clientInfo.app}#${clientInfo.os}#${clientInfo.device}#${clientInfo.device_id}`;
|
||||
const escapedName = escape(clientInfo.app);
|
||||
return `${escapedName}#${clientInfo.os}#${clientInfo.device}#${clientInfo.device_id}`;
|
||||
}
|
||||
|
||||
export function deconstructClientId(clientId: string): ClientIdConstituents {
|
||||
if (!clientId || clientId.split('#').length !== 4) {
|
||||
console.error(`Attempted to deconstruct invalid clientId: "${clientId}"`);
|
||||
}
|
||||
const [app, os, device, device_id] = clientId.split('#');
|
||||
let [app, os, device, device_id] = clientId.split('#');
|
||||
app = unescape(app);
|
||||
return {
|
||||
app,
|
||||
os,
|
||||
|
||||
Reference in New Issue
Block a user