@@ -540,8 +540,7 @@ perform_cleanup() {
540540 safe_clean ~ /Library/Caches/com.apple.photoanalysisd " Photo analysis cache"
541541 safe_clean ~ /Library/Caches/com.apple.akd " Apple ID cache"
542542 safe_clean ~ /Library/Caches/com.apple.Safari/Webpage\ Previews/* " Safari webpage previews"
543- safe_clean ~ /Library/Mail/V* /MailData/Envelope\ Index* " Mail envelope index"
544- safe_clean ~ /Library/Mail/V* /MailData/BackupTOC.plist " Mail backup index"
543+ # Mail envelope index and backup index are intentionally not cleaned (issue #32)
545544 safe_clean ~ /Library/Application\ Support/CloudDocs/session/db/* " iCloud session cache"
546545 end_section
547546
@@ -1116,6 +1115,7 @@ perform_cleanup() {
11161115 # Note: Disabled by default - container names may not match Bundle IDs
11171116 MOLE_SPINNER_PREFIX=" " start_inline_spinner " Scanning orphaned containers..."
11181117 local containers_found=0
1118+ local containers_size_kb=0
11191119 if ls ~ /Library/Containers/com.* > /dev/null 2>&1 ; then
11201120 # Count potential orphaned containers but don't delete them
11211121 for container_dir in ~ /Library/Containers/com.* ~ /Library/Containers/org.* ~ /Library/Containers/net.* ~ /Library/Containers/io.* ; do
@@ -1124,15 +1124,20 @@ perform_cleanup() {
11241124 if is_orphaned " $bundle_id " " $container_dir " ; then
11251125 local size_kb=$( du -sk " $container_dir " 2> /dev/null | awk ' {print $1}' || echo " 0" )
11261126 if [[ " $size_kb " -gt 0 ]]; then
1127- # DISABLED: safe_clean "$container_dir" "Orphaned container: $bundle_id"
1127+ # DISABLED: Not cleaned due to potential Bundle ID mismatch risk
11281128 (( containers_found++ ))
1129- (( total_orphaned_kb += size_kb))
1129+ (( containers_size_kb += size_kb))
11301130 fi
11311131 fi
11321132 done
11331133 fi
11341134 stop_inline_spinner
1135- echo -e " ${GREEN}${ICON_SUCCESS}${NC} Skipped $containers_found potential orphaned containers"
1135+ if [[ $containers_found -gt 0 ]]; then
1136+ local containers_mb=$( echo " $containers_size_kb " | awk ' {printf "%.1f", $1/1024}' )
1137+ echo -e " ${GREEN}${ICON_SUCCESS}${NC} Skipped $containers_found potential orphaned containers (~${containers_mb} MB)"
1138+ else
1139+ echo -e " ${GREEN}${ICON_SUCCESS}${NC} No potential orphaned containers found"
1140+ fi
11361141
11371142 # Clean orphaned WebKit data
11381143 MOLE_SPINNER_PREFIX=" " start_inline_spinner " Scanning orphaned WebKit data..."
@@ -1194,8 +1199,8 @@ perform_cleanup() {
11941199 stop_inline_spinner
11951200 echo -e " ${GREEN}${ICON_SUCCESS}${NC} Found $cookies_found orphaned cookie files"
11961201
1197- # Calculate total
1198- orphaned_count=$(( cache_found + logs_found + states_found + containers_found + webkit_found + http_found + cookies_found))
1202+ # Calculate total (exclude containers since they were not cleaned)
1203+ orphaned_count=$(( cache_found + logs_found + states_found + webkit_found + http_found + cookies_found))
11991204
12001205 if [[ $orphaned_count -gt 0 ]]; then
12011206 local orphaned_mb=$( echo " $total_orphaned_kb " | awk ' {printf "%.1f", $1/1024}' )
0 commit comments