Skip to content

Fix case-sensitive path matching in iOS backup description - #12

Merged
Lcharvol merged 1 commit into
Lcharvol:mainfrom
davidnichols-ops:fix/ios-backup-case-insensitive-path
Jul 30, 2026
Merged

Fix case-sensitive path matching in iOS backup description#12
Lcharvol merged 1 commit into
Lcharvol:mainfrom
davidnichols-ops:fix/ios-backup-case-insensitive-path

Conversation

@davidnichols-ops

Copy link
Copy Markdown

Problem

The describeIOSBackup function in FileDescriptions.swift used a case-sensitive range(of:) search for "MobileSync/Backup/" in the file path. On macOS, where the filesystem is case-insensitive by default, the actual path casing may differ from the canonical form (e.g. "mobilesync/backup/"). When this happened, the function failed to locate the backup root and fell back to a generic "iOS backup: " label instead of reading the device name and backup date from the backup's Info.plist.

Fix

  • Switch the path search to case-insensitive matching so backup metadata is correctly extracted regardless of path casing.
  • Simplify a confusing guard-let pattern where the nil-coalescing right side was never nil, making the else branch dead code. Replaced with a plain let.
  • Add a test (describesIOSBackupWithNonCanonicalCasing) that verifies a lowercase path still produces an "iOS" description.

All 9 FileDescriptions tests pass.

The describeIOSBackup function used a case-sensitive range search for
"MobileSync/Backup/" in the file path. On macOS, where the filesystem
is case-insensitive by default, the actual path casing may differ from
the canonical form (e.g. "mobilesync/backup/"). This caused the
function to miss the backup root and fall back to a generic description
instead of reading the device name and backup date from Info.plist.

Switch to a case-insensitive search so the backup metadata is correctly
extracted regardless of path casing.

Also simplify a confusing guard-let pattern where the nil-coalescing
right side was never nil, making the else branch dead code. Replace
with a plain let.
@Lcharvol
Lcharvol merged commit fecf3da into Lcharvol:main Jul 30, 2026
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.

2 participants