Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob] Fix IDN domain display in public URLs

Neeraj Gupta58a09e3b72da
diff --git a/mobile/apps/photos/lib/services/collections_service.dart b/mobile/apps/photos/lib/services/collections_service.dart
index dc5147ee9b..d104024c32 100644
--- a/mobile/apps/photos/lib/services/collections_service.dart
+++ b/mobile/apps/photos/lib/services/collections_service.dart
@@ -756,16 +756,33 @@ class CollectionsService {
String getPublicUrl(Collection c) {
final PublicURL url = c.publicURLs.firstOrNull!;
Uri publicUrl = Uri.parse(url.url);
+
+ // Replace with custom domain if configured
final String customDomain = flagService.customDomain;
if (customDomain.isNotEmpty) {
- publicUrl =
- publicUrl.replace(host: customDomain, scheme: "https", port: 443);
+ publicUrl = publicUrl.replace(
+ host: customDomain,
+ scheme: "https",
+ port: 443,
+ );
}
+
+ // Get the collection key for the URL fragment
final String collectionKey = Base58Encode(
CollectionsService.instance.getCollectionKey(c.id),
);
- final String urlValue = "${publicUrl.toString()}#$collectionKey";
- return urlValue;
+
+ // Build the final URL
+ String finalUrl = publicUrl.toString();
+
+ // Handle IDN domains - if the host was percent-encoded by Uri.replace,
+ // decode it for user-friendly display
+ if (customDomain.isNotEmpty && publicUrl.host.contains('%')) {
+ final decodedHost = Uri.decodeComponent(publicUrl.host);
+ finalUrl = finalUrl.replaceFirst(publicUrl.host, decodedHost);
+ }
+
+ return "$finalUrl#$collectionKey";
}
Uint8List _getAndCacheDecryptedKey(
diff --git a/mobile/apps/photos/scripts/internal_changes.txt b/mobile/apps/photos/scripts/internal_changes.txt
index dcc6925cc3..077269d1bd 100644
--- a/mobile/apps/photos/scripts/internal_changes.txt
+++ b/mobile/apps/photos/scripts/internal_changes.txt
@@ -1,3 +1,4 @@
+- Neeraj: Fix IDN domain display in public URLs [#7079](https://github.com/ente-io/ente/issues/7079)
- Neeraj: (i) Add allow joining album option in manage links
- Neeraj: Fix lock error + improve logViewer
- Laurens: text embedding caching for memories and discover