mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix(ios): normalize team IDs before preferred match
Co-authored-by: Brian Leach <bleach@gmail.com>
This commit is contained in:
@@ -10,6 +10,8 @@ preferred_team="${IOS_PREFERRED_TEAM_ID:-${OPENCLAW_IOS_DEFAULT_TEAM_ID:-Y5PE65H
|
|||||||
preferred_team_name="${IOS_PREFERRED_TEAM_NAME:-}"
|
preferred_team_name="${IOS_PREFERRED_TEAM_NAME:-}"
|
||||||
allow_keychain_fallback="${IOS_ALLOW_KEYCHAIN_TEAM_FALLBACK:-0}"
|
allow_keychain_fallback="${IOS_ALLOW_KEYCHAIN_TEAM_FALLBACK:-0}"
|
||||||
prefer_non_free_team="${IOS_PREFER_NON_FREE_TEAM:-1}"
|
prefer_non_free_team="${IOS_PREFER_NON_FREE_TEAM:-1}"
|
||||||
|
preferred_team="${preferred_team//$'\r'/}"
|
||||||
|
preferred_team_name="${preferred_team_name//$'\r'/}"
|
||||||
|
|
||||||
declare -a team_ids=()
|
declare -a team_ids=()
|
||||||
declare -a team_is_free=()
|
declare -a team_is_free=()
|
||||||
@@ -34,6 +36,9 @@ append_team() {
|
|||||||
local candidate_id="$1"
|
local candidate_id="$1"
|
||||||
local candidate_is_free="$2"
|
local candidate_is_free="$2"
|
||||||
local candidate_name="$3"
|
local candidate_name="$3"
|
||||||
|
candidate_id="${candidate_id//$'\r'/}"
|
||||||
|
candidate_is_free="${candidate_is_free//$'\r'/}"
|
||||||
|
candidate_name="${candidate_name//$'\r'/}"
|
||||||
[[ -z "$candidate_id" ]] && return
|
[[ -z "$candidate_id" ]] && return
|
||||||
|
|
||||||
local i
|
local i
|
||||||
|
|||||||
@@ -192,4 +192,40 @@ exit 0`,
|
|||||||
expect(result.ok).toBe(true);
|
expect(result.ok).toBe(true);
|
||||||
expect(result.stdout).toBe("BBBBB22222");
|
expect(result.stdout).toBe("BBBBB22222");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("matches preferred team IDs even when parser output uses CRLF line endings", async () => {
|
||||||
|
const homeDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-ios-team-id-"));
|
||||||
|
const binDir = path.join(homeDir, "bin");
|
||||||
|
await mkdir(binDir, { recursive: true });
|
||||||
|
await mkdir(path.join(homeDir, "Library", "Preferences"), { recursive: true });
|
||||||
|
await writeFile(path.join(homeDir, "Library", "Preferences", "com.apple.dt.Xcode.plist"), "");
|
||||||
|
|
||||||
|
await writeExecutable(
|
||||||
|
path.join(binDir, "plutil"),
|
||||||
|
`#!/usr/bin/env bash
|
||||||
|
echo '{}'`,
|
||||||
|
);
|
||||||
|
await writeExecutable(
|
||||||
|
path.join(binDir, "defaults"),
|
||||||
|
`#!/usr/bin/env bash
|
||||||
|
if [[ "$3" == "DVTDeveloperAccountManagerAppleIDLists" ]]; then
|
||||||
|
echo '(identifier = "dev@example.com";)'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 0`,
|
||||||
|
);
|
||||||
|
await writeExecutable(
|
||||||
|
path.join(binDir, "fake-python"),
|
||||||
|
`#!/usr/bin/env bash
|
||||||
|
printf 'AAAAA11111\\t0\\tAlpha Team\\r\\n'
|
||||||
|
printf 'BBBBB22222\\t0\\tBeta Team\\r\\n'`,
|
||||||
|
);
|
||||||
|
|
||||||
|
const result = runScript(homeDir, {
|
||||||
|
IOS_PYTHON_BIN: path.join(binDir, "fake-python"),
|
||||||
|
IOS_PREFERRED_TEAM_ID: "BBBBB22222",
|
||||||
|
});
|
||||||
|
expect(result.ok).toBe(true);
|
||||||
|
expect(result.stdout).toBe("BBBBB22222");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user