You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android: attaching a file whose name contains [ or ] fails with "Illegal character in path" #28956
On the Android app, attaching a PDF whose name contains square brackets (e.g. … Oxford [Oxfordshire] …pdf) fails with a "Could not attach file" alert. Other files attach fine.
Diagnosis
persistComposerAttachmentFile (apps/mobile/src/lib/composerImages.ts) builds the destination with new File(directory, ${uuidv4()}-${safeName}). safeName only replaces /, \ and control characters.
expo-file-system 58.0.9 builds the URI with encodeURLChars and the WHATWG URL pathname setter, which escape spaces, %, ?, # and non-ASCII characters but leave [, ] and | raw. On Android, JavaFile calls File(URI.create(uri.toString())) (unifiedfile/JavaFile.kt). java.net.URI rejects those characters, so copy() throws; index 218 in the error is the first [. The chunked-copy path for content: sources calls destination.create() on the same URI and should fail the same way.
downloadFileName (apps/mobile/src/lib/attachmentDownload.ts) has the same gap, so downloads probably fail too (not reproduced).
Suggested fix: the on-disk name is internal and the original is kept in name, so map everything outside [A-Za-z0-9._ -] to - and keep the extension. Checked against main @ fa31b66.
Steps to reproduce
On Android, open a thread and tap + to attach a file.
Pick a file named e.g. Report [draft].pdf.
Version
2.2.0
Environment
Android app, connected to a Windows 11 desktop host
Evidence
Call to function'FileSystemFile.copy' has been rejected.
→ Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 218:
file:///data/user/0/com.t3tools.t3code/files/t3-composer-attachments/d16e49e7-…-<title>%20--%20Oxford%20[Oxfordshire]%20;%20New%20York,…pdf
Activity
arandomhooman commentedon Nov 1, 2026