Commit ebbb482
committed
fix(macos): Fix image attachment not displaying in chat input
## Problem
When users selected images on macOS, the file path did not appear
in the chat input field due to:
1. **Duplicate case statement** (script.ts:2099-2106)
- JavaScript switch had two 'imagePath' cases
- Only the last matching case executes
- First (correct) handler was never executed
2. **Data structure mismatch** (extension.ts:1956-1959)
- Backend sent: {type: 'imagePath', path: '/path'}
- Frontend expected: {type: 'imagePath', data: {filePath: '/path'}}
- Frontend couldn't find the data → silent failure
## Solution
- **Removed duplicate case statement** in script.ts
- Deleted lines 2099-2106
- Only correct handler (lines 1979-2006) remains
- **Unified data structure** in extension.ts
- Changed to send {data: {filePath}} format
- Matches frontend expectation
- Consistent with other message types
## Testing
Tested in Extension Development Host (F5):
- ✅ Click image button → Finder opens
- ✅ Select single image → Path appears in chat input
- ✅ Select multiple images → All paths appear
- ✅ Cancel selection → No errors
## Impact
- **Users**: macOS users can now attach images successfully
- **Code Quality**: Removed code duplication, unified data structure
- **Compatibility**: No breaking changes
## Files Changed
- src/script.ts: Remove duplicate case (-11 lines)
- src/extension.ts: Fix data structure (+4, -1 lines)1 parent d891070 commit ebbb482
2 files changed
+4
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1955 | 1955 | | |
1956 | 1956 | | |
1957 | 1957 | | |
1958 | | - | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
1959 | 1961 | | |
1960 | 1962 | | |
1961 | 1963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2070 | 2070 | | |
2071 | 2071 | | |
2072 | 2072 | | |
2073 | | - | |
2074 | | - | |
2075 | | - | |
2076 | | - | |
2077 | | - | |
2078 | | - | |
2079 | | - | |
2080 | | - | |
2081 | | - | |
2082 | | - | |
| 2073 | + | |
2083 | 2074 | | |
2084 | 2075 | | |
2085 | 2076 | | |
| |||
0 commit comments