Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: aliyun cors detection#181

Merged
timerring merged 1 commit intomainfrom
dev
Feb 9, 2026
Merged

fix: aliyun cors detection#181
timerring merged 1 commit intomainfrom
dev

Conversation

@timerring
Copy link
Member

Summary / 概述

Fixed Aliyun Developer platform avatar CORS/ORB issue by converting avatar images to base64 format before use.

Related Issue / 关联 Issue

N/A

Type of Change / 更改类型

  • Bug fix / 修复 Bug (non-breaking change that fixes an issue / 修复问题的非破坏性更改)
  • New feature / 新功能 (non-breaking change that adds functionality / 添加功能的非破坏性更改)
  • Breaking change / 破坏性更改 (fix or feature that would cause existing functionality to not work as expected / 会导致现有功能无法正常工作的修复或功能)
  • Documentation update / 文档更新
  • Performance improvement / 性能优化
  • Code refactoring / 代码重构
  • Other / 其他 (please describe / 请描述):

Changes Made / 更改内容

  • Added convertAvatarToBase64 utility import from utils.js
  • Modified detectAliyunUser function to convert avatar URL to base64 before returning
  • Updated inline documentation to reflect the new step in detection strategy

Implementation Details / 实现细节

Key Changes / 主要更改:

  • Import convertAvatarToBase64 function from '../utils.js'
  • Extract avatar value into a variable before returning
  • Check if avatar exists, then convert it to base64 using convertAvatarToBase64(avatar, 'https://developer.aliyun.com/')
  • Return the base64-encoded avatar instead of the original URL

Technical Notes / 技术说明:

  • This change addresses CORS (Cross-Origin Resource Sharing) and ORB (Opaque Response Blocking) restrictions
  • By converting the avatar to base64, we eliminate cross-origin image loading issues
  • The conversion happens asynchronously using await to ensure proper data retrieval

Testing / 测试

Testing Checklist / 测试清单

  • I have tested this code locally / 我已在本地测试此代码
  • All existing tests pass / 所有现有测试通过
  • I have added tests for new functionality / 我已为新功能添加测试
  • I have tested on the affected platform(s) / 我已在受影响的平台上测试
  • I have verified the changes work in the target browser(s) / 我已验证更改在目标浏览器中有效

Manual Testing Steps / 手动测试步骤

  1. Log into Aliyun Developer platform
  2. Verify that the avatar image loads correctly without CORS errors
  3. Check browser console for any cross-origin related errors

Screenshots/Videos / 截图/视频

If applicable, add screenshots or videos to demonstrate the changes

Reviewer Checklist / 审阅者清单

  • Code follows the project's style guidelines / 代码遵循项目的风格指南
  • Changes are well-documented / 更改有良好的文档说明
  • No breaking changes or clearly documented if present / 无破坏性更改,或已清楚记录
  • Security implications have been considered / 已考虑安全影响
  • Performance impact has been evaluated / 已评估性能影响
  • All discussions have been resolved / 所有讨论已解决

Additional Notes / 补充说明

This fix ensures that Aliyun Developer platform users can properly view avatars without encountering CORS restrictions. The base64 conversion is a common workaround for cross-origin image loading issues.

@timerring timerring self-assigned this Feb 9, 2026
@timerring timerring added the enhancement New feature or request label Feb 9, 2026
Copy link
Member Author

@timerring timerring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@timerring timerring merged commit e6e5951 into main Feb 9, 2026
@timerring timerring deleted the dev branch February 9, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant