zulip-flutter icon indicating copy to clipboard operation
zulip-flutter copied to clipboard

Handle relative URLs in auth method display icons

Open deepak20001 opened this issue 3 weeks ago • 2 comments

Summary

Implements support for relative URLs in display_icon field for external authentication methods, as requested in #1969.

Changes

  • Modified lib/widgets/login.dart to resolve relative URLs against realmUrl before passing to Image.network()
  • Added unit test in test/widgets/login_test.dart to 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

deepak20001 avatar Nov 07 '25 20:11 deepak20001