Skip to content

armgit / ente

Public Imported from GitHub
0

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

Support path tokens for public album links in Photos

Anand Baburajan3d307736bfca
diff --git a/mobile/apps/photos/lib/services/collections_service.dart b/mobile/apps/photos/lib/services/collections_service.dart
index 16ef07b546..d736e29078 100644
--- a/mobile/apps/photos/lib/services/collections_service.dart
+++ b/mobile/apps/photos/lib/services/collections_service.dart
@@ -48,6 +48,14 @@ import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/file_key.dart";
import 'package:shared_preferences/shared_preferences.dart';
+String? _resolvePublicAlbumAccessToken(Uri uri) {
+ final tokenFromQuery = uri.queryParameters["t"];
+ if (tokenFromQuery != null && tokenFromQuery.isNotEmpty) {
+ return tokenFromQuery;
+ }
+ return uri.pathSegments.firstWhereOrNull((segment) => segment.isNotEmpty);
+}
+
class CollectionsService {
static const _collectionSyncTimeKeyPrefix = "collection_sync_time_";
static const _collectionsSyncTimeKey = "collections_sync_time_x";
@@ -1565,7 +1573,7 @@ class CollectionsService {
BuildContext context,
Uri uri,
) async {
- final String? authToken = uri.queryParameters["t"];
+ final String? authToken = _resolvePublicAlbumAccessToken(uri);
final String albumKey = uri.fragment;
try {
final responseData = await collectionShareGateway.getPublicCollectionInfo(