fix remote file stream function (#1620)

This commit is contained in:
Mike Sawka 2024-12-26 10:23:28 -08:00 committed by GitHub
parent d833f57214
commit 904d942c4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 13 deletions

View File

@ -14,7 +14,7 @@ Legend: ✅ Done | 🔧 In Progress | 🔷 Planned | 🤞 Stretch Goal
- 🔷 Remote S3 bucket browsing (directory + files)
- 🔷 Drag & drop between preview blocks
- 🔷 Drag into a preview directory from the native file browser or desktop to copy a file
- 🔷 EC-TIME timeout when transferring large files
- EC-TIME timeout when transferring large files
- 🤞 log viewer
- 🤞 binary viewer
- 🔷 Wave Apps (Go SDK)
@ -27,7 +27,6 @@ Legend: ✅ Done | 🔧 In Progress | 🔷 Planned | 🤞 Stretch Goal
- 🔷 Multi-Input between terminal blocks on the same tab
- 🔧 Gemini AI support
- 🔷 Monaco Theming
- 🤞 Log Viewer (stretch)
- 🤞 Blockcontroller fixes for terminal escape sequences
- 🤞 Explore VSCode Extension Compatibility with standalone Monaco Editor (language servers)
- 🔷 Various Connection Bugs + Improvements

View File

@ -187,18 +187,21 @@ func (impl *ServerImpl) remoteStreamFileInternal(ctx context.Context, data wshrp
func (impl *ServerImpl) RemoteStreamFileCommand(ctx context.Context, data wshrpc.CommandRemoteStreamFileData) chan wshrpc.RespOrErrorUnion[wshrpc.CommandRemoteStreamFileRtnData] {
ch := make(chan wshrpc.RespOrErrorUnion[wshrpc.CommandRemoteStreamFileRtnData], 16)
defer close(ch)
err := impl.remoteStreamFileInternal(ctx, data, func(fileInfo []*wshrpc.FileInfo, data []byte) {
resp := wshrpc.CommandRemoteStreamFileRtnData{}
resp.FileInfo = fileInfo
if len(data) > 0 {
resp.Data64 = base64.StdEncoding.EncodeToString(data)
go func() {
defer close(ch)
err := impl.remoteStreamFileInternal(ctx, data, func(fileInfo []*wshrpc.FileInfo, data []byte) {
resp := wshrpc.CommandRemoteStreamFileRtnData{}
resp.FileInfo = fileInfo
if len(data) > 0 {
resp.Data64 = base64.StdEncoding.EncodeToString(data)
}
log.Printf("callback -- sending response %d\n", len(resp.Data64))
ch <- wshrpc.RespOrErrorUnion[wshrpc.CommandRemoteStreamFileRtnData]{Response: resp}
})
if err != nil {
ch <- respErr(err)
}
ch <- wshrpc.RespOrErrorUnion[wshrpc.CommandRemoteStreamFileRtnData]{Response: resp}
})
if err != nil {
ch <- respErr(err)
}
}()
return ch
}