Skip to content

Conversation

@prateekmedia
Copy link
Member

Description

Tests

… URL

This fixes an intermittent issue where copying an album share link would
result in just the hash fragment (e.g., ente-io#1234) being copied instead of
the full URL (e.g., https://albums.ente.io/?t=1234#key).

Root cause:
After building the URL with Uri.replace(), the code attempted to decode
IDN domains with string replacement:

    if (customDomain.isNotEmpty && publicUrl.host.contains('%')) {
      final decodedHost = Uri.decodeComponent(publicUrl.host);
      finalUrl = finalUrl.replaceFirst(publicUrl.host, decodedHost);
    }

This string replacement could fail or match incorrectly, corrupting the
URL and sometimes leaving only the fragment portion.

Fix:
Remove the string manipulation entirely. Uri.toString() already handles
IDN encoding correctly, so the manual decoding is unnecessary and was
causing the corruption.
@prateekmedia prateekmedia marked this pull request as draft November 6, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant