mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 19:52:10 +00:00
made file-extensions case insensitive
This commit is contained in:
parent
5890b3734a
commit
0a84014689
@ -117,7 +117,7 @@ public static class FileTypes
|
|||||||
|
|
||||||
if (types.Any(t => t.ContainsType(SOURCE_LIKE_FILE_NAMES)))
|
if (types.Any(t => t.ContainsType(SOURCE_LIKE_FILE_NAMES)))
|
||||||
{
|
{
|
||||||
if (SOURCE_LIKE_FILE_NAMES.FilterExtensions.Contains(fileName))
|
if (SOURCE_LIKE_FILE_NAMES.FilterExtensions.Contains(fileName, StringComparer.OrdinalIgnoreCase))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -190,10 +190,14 @@ async fn stream_data(file_path: &str, extract_images: bool) -> Result<ChunkStrea
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let ext = file_path.split('.').next_back().unwrap_or("");
|
let ext = Path::new(file_path)
|
||||||
|
.extension()
|
||||||
|
.and_then(|extension| extension.to_str())
|
||||||
|
.map(str::to_ascii_lowercase)
|
||||||
|
.unwrap_or_default();
|
||||||
debug!("Extracting data from file: '{file_path}', format: '{fmt:?}', extension: '{ext}'");
|
debug!("Extracting data from file: '{file_path}', format: '{fmt:?}', extension: '{ext}'");
|
||||||
|
|
||||||
let stream = match ext {
|
let stream = match ext.as_str() {
|
||||||
DOCX | ODT => {
|
DOCX | ODT => {
|
||||||
let from = if ext == DOCX { "docx" } else { "odt" };
|
let from = if ext == DOCX { "docx" } else { "odt" };
|
||||||
convert_with_pandoc(file_path, from, TO_MARKDOWN).await?
|
convert_with_pandoc(file_path, from, TO_MARKDOWN).await?
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user