feat: configurable GitLab repository file payload encoding (text/base64)#382
Merged
zereight merged 2 commits intozereight:mainfrom Mar 22, 2026
Merged
feat: configurable GitLab repository file payload encoding (text/base64)#382zereight merged 2 commits intozereight:mainfrom
zereight merged 2 commits intozereight:mainfrom
Conversation
added 2 commits
March 20, 2026 12:19
… API interactions - Introduced GITLAB_REPO_FILE_ENCODING to specify encoding (text or base64) for file payloads. - Updated file handling functions to utilize the new encoding option. - Enhanced .env.example and README.md to document the new configuration.
- Changed base64 decoding to explicitly convert to UTF-8. - Added encoding property to parsed data for clarity.
zereight
approved these changes
Mar 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional configuration for how repository file payloads are sent to the GitLab Repository API when creating/updating files, creating trees, and creating commits. The default remains
text(unchanged behavior).Motivation
Some GitLab instances or intermediaries handle large or unusual character content more reliably when the API receives
encoding: "base64"with base64-encodedcontent. This change lets operators opt into that without forking.What changed
GITLAB_REPO_FILE_ENCODING—text(default) orbase64.--repo-file-encoding=text|base64(via existinggetConfig, same precedence as other flags: CLI over env).encodeRepoFilePayloadContent()— whenbase64is selected, string content is encoded before sending.createOrUpdateFile,createTree, andcreateCommit.getFileContents: still decodes API base64contentto a plain string; no longer overwritesencodingwith a fixedutf8value after decode (aligns with API semantics).Configuration
GITLAB_REPO_FILE_ENCODING=base64--repo-file-encoding=base64Documented in README and
.env.example.Backward compatibility
textencoding and raw string content.text(onlybase64enables base64 mode).Notes for reviewers
GITLAB_REPO_FILE_ENCODING=base64if the project’s test harness supports it.