zulip-flutter
zulip-flutter copied to clipboard
Handle relative URLs in auth method display icons
Summary
Implements support for relative URLs in display_icon field for external authentication methods, as requested in #1969.
Changes
- Modified
lib/widgets/login.dartto resolve relative URLs againstrealmUrlbefore passing toImage.network() - Added unit test in
test/widgets/login_test.dartto verify relative URL resolution works correctly
Implementation Details
The fix checks if displayIcon starts with http:// or https://. If not, it resolves the relative URL against realmUrl using Uri.resolve(), matching the pattern used for loginUrl resolution at line 359.
Example:
- Relative URL:
/static/images/google-icon.png - Resolved to:
https://chat.zulip.org/static/images/google-icon.png
Testing
- ✅ Unit test added and passing: Verifies relative URLs are correctly resolved to absolute URLs
- ✅ Backward compatibility: Absolute URLs still work as before (verified by existing test)
- ⚠️ Manual testing: I wasn't able to set up a test Zulip server to manually verify this. The unit test covers the logic, but would appreciate help from maintainers or other contributors to verify the manual testing requirement mentioned in the issue.
Related
Fixes #1969