Consume TOKEN_DOWNLOAD_ERROR in the file manager and fail the matching
preview request with the client's win32 code instead of sending
COMMAND_EXCEPTION and leaving the request to the 15 s watchdog.
Key the exact size/mtime metadata by the list's displayed ANSI/GBK text,
not the raw protocol bytes: Linux/macOS send UTF-8 names while GetItemText
returns the process ACP, so non-ASCII files previously missed the metadata
lookup and could not start a preview.
Bind the Unix progress dialog to the preview request so a stalled transfer
closes it on timeout; save the index after LRU eviction; make the local
right-click Open honour search-result paths; reject over-long received
names; and defer abandoned temp-dir deletion to the watchdog.
The new download-error and hash-error strings are added to en_US, zh_TW
and de_DE.
Co-Authored-By: deepseek-flash
When the main connection advertises CLIENT_CAP_FILE_HASH, double-click
sends COMMAND_FILE_HASH first and continues from the async
TOKEN_FILE_HASH response (posted to the UI thread). A matching SHA-256
opens the cached copy without a transfer, including content found under
a different remote path; the new path is added to the index. Too-large
and error responses are handled, and a 5 second timeout falls back to the
P1 size/mtime path.
The response parser is based on FileHashResponseHeader and the echoed
request path; pending state is cleared on close and the hash timer is
killed with the dialog.
Verified with the Debug server and client: a 1 MiB file was hashed,
transferred and cached under its SHA-256; an identical copy at a second
path hit the cache with no new transfer or stream connection.
Co-Authored-By: deepseek-flash
Release the DeviceTransferGate only after leaving m_PendingMutex in the
three MCP begin paths, matching the documented gate -> pending -> xfer
order (the gate mutex is brief, but this keeps the order explicit and
avoids future nesting mistakes).
Also short-circuit ObserveChunk when there are no preview requests or
tombstones, so ordinary V2 chunk paths do not scan the preview maps.
Co-Authored-By: deepseek-flash
Add the preview strings to en_US, zh_TW and de_DE (GBK, no '=' in keys;
German uses ASCII transliterations where GBK cannot encode umlauts), and
pass the cached entry's SHA-256 back to the open helper so the executable
confirmation shows the actual hash on a cache hit.
Honour PreviewEnabled=0 by leaving double-click unchanged, and document
the preview plus COMMAND_FILE_HASH capability in the client matrix.
Co-Authored-By: deepseek-flash
Add FilePreview.h/.cpp with the non-UI half of the double-click preview:
a flat per-client cache (Preview\<clientKey>\<hash16>_<basename>), a
per-client index keyed by remote path and SHA-256, size/mtime metadata
hits, the 8 MiB gate, empty-file handling, LRU caps, and the executable
confirmation plus ShellExecute helper.
DeviceTransferGate is the shared device-level claim used by preview and
the MCP file-transfer entry points so one device can only run one file
transfer at a time; C2C claims both src and dst. The receive hooks
(ObserveChunk/OnComplete) are implemented here and called by the file
manager paths in the next commit.
Co-Authored-By: deepseek-flash