Skip to content

Commit 388058d

Browse files
committed
Adapt tests for 4/3 size increase
1 parent aa2cc66 commit 388058d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

services/repository/files/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func GetContentsListFromTrees(ctx context.Context, repo *repo_model.Repository,
2626
fileContents, _ := GetContents(ctx, repo, refCommit, file, false) // ok if fails, then will be nil
2727
if fileContents != nil && *fileContents.Content != "" {
2828
// if content isn't empty (e.g. due to the single blob being too large), add file size to response size
29-
// the content is base64 encoded
29+
// the content is base64 encoded, so it's size increases to around 4/3 of the original size
3030
size += fileContents.Size * 4 / 3
3131
}
3232
if size > setting.API.DefaultMaxResponseSize {

tests/integration/api_repo_files_get_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,5 @@ func testAPIGetRequestedFiles(t *testing.T, u *url.URL) {
235235
resp = MakeRequest(t, req, http.StatusOK)
236236
DecodeJSON(t, resp, &contentsListResponse)
237237
assert.NotNil(t, contentsListResponse)
238-
assert.Len(t, contentsListResponse, 20)
238+
assert.Len(t, contentsListResponse, 15) // base64-encoded content is around 4/3 the size of the original content
239239
}

0 commit comments

Comments
 (0)