Skip to content

fix: escape app names in app icons JSON - #158

Open
sey8n wants to merge 1 commit into
sameerasw:developfrom
sey8n:fix/escape-app-names-in-app-icons-json
Open

sey8n wants to merge 1 commit into
sameerasw:developfrom
sey8n:fix/escape-app-names-in-app-icons-json

Conversation

@sey8n

@sey8n sey8n commented Oct 15, 2026

Copy link
Copy Markdown

Problem

After pairing, the Mac app's Apps grid and the per-app list in Settings → Notifications & Alerts → App notifications stay empty, and "Mute app" has no effect. The Android side logs ✅ App icons sent successfully (199 icons with full app details), but nothing ever gets stored on the Mac (~/Library/Application Support/airsync-mac/AppIcons stays empty).

Root cause

JsonUtil.createAppIconsJson inserts app.appName into the JSON without escaping. Some apps ship a launcher label that contains a line break. For example, kr.co.dgb.dgbm (iM Bank) is labelled iM뱅크\n(아이엠). A raw newline inside a JSON string is invalid, so the Mac's JSONDecoder rejects the entire appIcons message. It only prints [websocket] JSON decode failed and drops the whole list.

The Mac's saved package list therefore stays empty. Every connect and every manual sync re-sends the full list and fails the same way. Notifications are not affected because createNotificationJson already uses escape().

Fix

  • Use the existing escape() helper for the app name in createAppIconsJson.
  • Make escape() also escape \t and the other control characters below U+0020 (as \uXXXX). JSON does not allow those unescaped either.

Testing

  • Reproduced on a Galaxy S23 (One UI 8.5) with AirSync 4.1.0 on Android and macOS. With kr.co.dgb.dgbm installed, "Sync App Icons" never populated the Mac app list. After removing only that app, the same sync stored all 198 apps and icons on the Mac.
  • Checked the new escaping rules with a script that mirrors them. Labels containing a newline, tab, quote, backslash or NUL produce appIcons JSON that parses and round-trips the names.
  • I could not build the project locally (no Android SDK on this machine), so please run a build before merging.

createAppIconsJson inserted app labels into the JSON without escaping.
A label that contains a line break or a quote produces invalid JSON, so
the Mac app fails to decode the whole appIcons message and drops it
without any visible error. Every sync fails the same way, which leaves
the Apps grid and the per-app notification list on the Mac empty.

Example: the launcher label of kr.co.dgb.dgbm is "iM뱅크\n(아이엠)".

Use the existing escape() helper for app names, and make escape() also
handle tabs and the other control characters JSON does not allow
unescaped.
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.

1 participant