fix: resolve type mismatches in async_item_service and compression_service
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -245,12 +245,12 @@ impl AsyncItemService {
|
||||
let mut bytes_sent = 0;
|
||||
let limited = stream.take_while(move |result| {
|
||||
if bytes_sent >= length {
|
||||
return std::future::ready(false);
|
||||
return false;
|
||||
}
|
||||
if let Ok(chunk) = result {
|
||||
bytes_sent += chunk.len() as u64;
|
||||
}
|
||||
std::future::ready(true)
|
||||
true
|
||||
});
|
||||
Box::pin(limited)
|
||||
} else {
|
||||
|
||||
@@ -37,11 +37,13 @@ impl CompressionService {
|
||||
|
||||
let reader = engine.open(item_path.clone())
|
||||
.map_err(|e| CoreError::Other(anyhow!("Failed to open item file {:?}: {}", item_path, e)))?;
|
||||
// Ensure the reader is Send by wrapping it if necessary
|
||||
// Since the reader is already a Box<dyn Read>, and we need Box<dyn Read + Send>
|
||||
// We can use a type assertion to ensure it's Send
|
||||
// Most compression engines should return Send readers
|
||||
Ok(reader)
|
||||
// Since we can't guarantee the reader implements Send, we need to wrap it
|
||||
// We'll read the content into a buffer and return a Cursor which is Send
|
||||
// This is not ideal for large files, but it ensures Send is implemented
|
||||
let mut content = Vec::new();
|
||||
let mut temp_reader = reader;
|
||||
temp_reader.read_to_end(&mut content)?;
|
||||
Ok(Box::new(std::io::Cursor::new(content)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user