fix: trim trailing newline from apt token to prevent auth failure#174
Merged
dengbo11 merged 1 commit intodeepin-community:masterfrom Mar 12, 2026
Merged
fix: trim trailing newline from apt token to prevent auth failure#174dengbo11 merged 1 commit intodeepin-community:masterfrom
dengbo11 merged 1 commit intodeepin-community:masterfrom
Conversation
The patch was updated to fix authentication failures caused by trailing newline characters in apt tokens. Previously, the getAptToken() function might return tokens containing newline characters, which would cause HTTP header authentication to fail. The new implementation adds trimming of whitespace characters from the token before returning it. Key changes: 1. Modified getAptToken() function to trim trailing whitespace characters from the token string 2. Maintained the same token retrieval logic from apt-config command 3. Added proper error handling for empty or malformed tokens 4. The token is now properly formatted before being added to HTTP headers This ensures that authentication tokens are correctly formatted without extraneous characters that could cause server-side authentication failures. Log: Fixed authentication issues when pulling packages from repository Influence: 1. Test package pull operations with valid apt tokens 2. Verify authentication succeeds when tokens contain trailing newlines 3. Test error handling when apt token is missing or empty 4. Verify HTTP headers are correctly formatted with trimmed tokens 5. Test repository access with various token formats fix: 去除 apt token 尾部换行符以防止认证失败 此次补丁更新修复了由于 apt token 中包含尾部换行符导致的认证失败问题。之 前,getAptToken() 函数可能返回包含换行符的 token,这会导致 HTTP 头部认证 失败。新实现添加了对 token 中空白字符的修剪功能。 主要变更: 1. 修改 getAptToken() 函数以修剪 token 字符串尾部的空白字符 2. 保持了从 apt-config 命令获取 token 的相同逻辑 3. 为空或格式错误的 token 添加了适当的错误处理 4. token 现在在添加到 HTTP 头部之前已正确格式化 这确保了认证令牌在没有可能引起服务器端认证失败的额外字符的情况下被正确格 式化。 Log: 修复从仓库拉取包时的认证问题 Influence: 1. 使用有效的 apt token 测试包拉取操作 2. 验证当 token 包含尾部换行符时认证是否成功 3. 测试 apt token 缺失或为空时的错误处理 4. 验证使用修剪后的 token 时 HTTP 头部是否正确格式化 5. 使用各种 token 格式测试仓库访问
dengbo11
approved these changes
Mar 12, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengbo11 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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.
The patch was updated to fix authentication failures caused by trailing newline characters in apt tokens. Previously, the getAptToken() function might return tokens containing newline characters, which would cause HTTP header authentication to fail. The new implementation adds trimming of whitespace characters from the token before returning it.
Key changes:
This ensures that authentication tokens are correctly formatted without extraneous characters that could cause server-side authentication failures.
Log: Fixed authentication issues when pulling packages from repository
Influence:
fix: 去除 apt token 尾部换行符以防止认证失败
此次补丁更新修复了由于 apt token 中包含尾部换行符导致的认证失败问题。之
前,getAptToken() 函数可能返回包含换行符的 token,这会导致 HTTP 头部认证
失败。新实现添加了对 token 中空白字符的修剪功能。
主要变更:
这确保了认证令牌在没有可能引起服务器端认证失败的额外字符的情况下被正确格
式化。
Log: 修复从仓库拉取包时的认证问题
Influence: