Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix local backup path display trimming

Prateek Sunal48c1828c8724
diff --git a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
index 193a035991..221e7ad82c 100644
--- a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
+++ b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
@@ -438,22 +438,49 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
}
String _simplifyPath(String fullPath) {
+ if (fullPath.isEmpty) {
+ return fullPath;
+ }
+
if (Platform.isAndroid) {
- const rootToRemove = '/storage/emulated/0/';
- if (fullPath.startsWith(rootToRemove)) {
- return fullPath.substring(rootToRemove.length);
+ const rootsToRemove = <String>[
+ '/storage/emulated/0/',
+ '/storage/self/primary/',
+ ];
+
+ for (final root in rootsToRemove) {
+ if (fullPath.startsWith(root)) {
+ return fullPath.substring(root.length);
+ }
}
return fullPath;
}
if (Platform.isIOS) {
var simplified = fullPath;
+ const fileScheme = 'file://';
+ if (simplified.startsWith(fileScheme)) {
+ simplified = simplified.substring(fileScheme.length);
+ }
// iOS often prepends /private when surfacing sandboxed locations.
const privatePrefix = '/private';
if (simplified.startsWith(privatePrefix)) {
simplified = simplified.substring(privatePrefix.length);
}
+ const icloudMarker = '/Mobile Documents/';
+ if (simplified.contains(icloudMarker)) {
+ final afterMarker = simplified.split(icloudMarker).last;
+ const cloudDocsPrefix = 'com~apple~CloudDocs/';
+ if (afterMarker.startsWith(cloudDocsPrefix)) {
+ final remaining = afterMarker.substring(cloudDocsPrefix.length);
+ return remaining.isNotEmpty ? 'iCloud Drive/$remaining' : 'iCloud Drive';
+ }
+ if (afterMarker.isNotEmpty) {
+ return afterMarker;
+ }
+ }
+
const markers = <String>[
'/File Provider Storage/',
'/Documents/',