Skip to content

Commit be0e1f5

Browse files
committed
do not filter out branches for tokenless uploads
1 parent 590f0f1 commit be0e1f5

File tree

2 files changed

+5
-37
lines changed

2 files changed

+5
-37
lines changed

packages/bundler-plugin-core/src/utils/__tests__/getPreSignedURL.test.ts

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe("getPreSignedURL", () => {
160160
retryCount: 0,
161161
serviceParams: {
162162
commit: "123",
163-
branch: "owner:branch",
163+
branch: "any-branch-format",
164164
},
165165
});
166166

@@ -185,7 +185,7 @@ describe("getPreSignedURL", () => {
185185
gitService: "github_enterprise",
186186
serviceParams: {
187187
commit: "123",
188-
branch: "owner:branch",
188+
branch: "any-branch-format",
189189
},
190190
});
191191

@@ -228,37 +228,6 @@ describe("getPreSignedURL", () => {
228228

229229
describe("unsuccessful request", () => {
230230
describe("no upload token present", () => {
231-
describe("branch is in incorrect format", () => {
232-
it("throws an error", async () => {
233-
const { consoleSpy } = setup({
234-
data: { url: "http://example.com" },
235-
});
236-
237-
let error;
238-
try {
239-
await getPreSignedURL({
240-
apiUrl: "http://localhost",
241-
retryCount: 0,
242-
gitService: "github",
243-
serviceParams: {
244-
commit: "123",
245-
branch: "main",
246-
},
247-
});
248-
} catch (e) {
249-
error = e;
250-
}
251-
252-
expect(consoleSpy).toHaveBeenCalled();
253-
// for some reason, this test fails even tho it's the same values
254-
// Expected: "No upload token found"
255-
// Received: "No upload token found"
256-
// Number of calls: 1
257-
// expect(consoleSpy).toHaveBeenCalledWith("No upload token found");
258-
expect(error).toBeInstanceOf(NoUploadTokenError);
259-
});
260-
});
261-
262231
describe("git service is not found", () => {
263232
beforeEach(() => {
264233
td.when(

packages/bundler-plugin-core/src/utils/getPreSignedURL.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ export const getPreSignedURL = async ({
4646

4747
const requestBody: RequestBody = serviceParams;
4848
/**
49-
* We currently require the branch to be in the format `owner:branch` to identify that it is a
50-
* proper tokenless upload.
51-
* See: https://github.com/codecov/codecov-api/pull/741
49+
* We require the branch to be in the format `owner:branch` for tokenless v2 upload.
50+
* True Tokenless is allowed with any branch format.
5251
*/
53-
if (!uploadToken && serviceParams.branch?.includes(":")) {
52+
if (!uploadToken) {
5453
if (gitService) {
5554
requestBody.git_service = gitService;
5655
} else {

0 commit comments

Comments
 (0)