Skip to content

Commit 55efdc4

Browse files
committed
fix: don't send empty repositories_mode
The server expects it to be either `replace` or `append`, not `""`. Signed-off-by: Paul Spooren <mail@aparcar.org>
1 parent 8be522a commit 55efdc4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

tests/js/asu.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ describe("createAsuRequestBuilder", () => {
173173
assert.equal(capturedBody.repositories_mode, "append");
174174
});
175175

176-
it("sends empty repositories_mode for unsupported mode values", async () => {
176+
it("omits repositories_mode for unsupported mode values", async () => {
177177
let capturedBody;
178178
globalThis.fetch = fetchWithLangStub((_url, opts) => {
179179
capturedBody = JSON.parse(opts.body);
@@ -196,7 +196,7 @@ describe("createAsuRequestBuilder", () => {
196196
build();
197197
await new Promise((r) => setTimeout(r, 50));
198198

199-
assert.equal(capturedBody.repositories_mode, "");
199+
assert.ok(!("repositories_mode" in capturedBody));
200200
});
201201

202202
it("sends GET with hash appended when requestHash is provided", async () => {

www/js/asu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ export function createAsuRequestBuilder(context) {
7777

7878
const selectedVersion = $("#versions").value;
7979
const reposMode = config.asu_repositories_mode;
80-
const repositoriesMode =
81-
reposMode === "replace" || reposMode === "append" ? reposMode : "";
8280
const buildBody = {
8381
profile: currentDevice.id,
8482
target: currentDevice.target,
@@ -94,8 +92,10 @@ export function createAsuRequestBuilder(context) {
9492
selectedVersion
9593
),
9694
repository_keys: config.asu_repository_keys || [],
97-
repositories_mode: repositoriesMode,
9895
};
96+
if (reposMode === "replace" || reposMode === "append") {
97+
buildBody.repositories_mode = reposMode;
98+
}
9999
const requestUrl =
100100
`${config.asu_url}/api/v1/build` + (requestHash ? `/${requestHash}` : "");
101101

0 commit comments

Comments
 (0)