Files
flipper/src/utils/androidContainerUtility.js
John Knox 7823389081 Enforce android command escaping with flow
Summary: Splits the utility into a public and private part - just for the opaque types to work. The private part validates arguments and does the command running. Both are safe to use, but the non-internal one is easier, you don't have to validate anything.

Reviewed By: passy

Differential Revision: D15393477

fbshipit-source-id: 92f63180fb94af4337fdf8c7dace5bc5a85d5a54
2019-05-17 09:53:37 -07:00

41 lines
920 B
JavaScript

/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import {
validateAppName,
validateFilePath,
validateFileContent,
_push,
_pull,
} from './androidContainerUtilityInternal';
export function push(
deviceId: string,
app: string,
filepath: string,
contents: string,
): Promise<void> {
return validateAppName(app).then(validApp =>
validateFilePath(filepath).then(validFilepath =>
validateFileContent(contents).then(validContent =>
_push(deviceId, validApp, validFilepath, validContent),
),
),
);
}
export function pull(
deviceId: string,
app: string,
path: string,
): Promise<string> {
return validateAppName(app).then(validApp =>
validateFilePath(path).then(validPath =>
_pull(deviceId, validApp, validPath),
),
);
}