File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,10 @@ async def __file_to_docs(
161
161
request = httpx .get (file , headers = {"User-Agent" : "Magic Browser" })
162
162
163
163
# Define mime type and source of url
164
- content_type = request .headers ["Content-Type" ].split (";" )[0 ]
164
+ # Add fallback for empty/None content_type
165
+ content_type = request .headers .get (
166
+ "Content-Type" , "text/html" if file .startswith (("http://" , "https://" )) else "text/plain"
167
+ ).split (";" )[0 ]
165
168
source = file
166
169
167
170
try :
@@ -183,6 +186,10 @@ async def __file_to_docs(
183
186
if not file_bytes :
184
187
raise ValueError (f"Something went wrong with the file { source } " )
185
188
189
+ log .debug (f"Attempting to parse file: { source } " )
190
+ log .debug (f"Detected MIME type: { content_type } " )
191
+ log .debug (f"Available handlers: { list (stray .file_handlers .keys ())} " )
192
+
186
193
# Load the bytes in the Blob schema
187
194
blob = Blob (data = file_bytes , mimetype = content_type ).from_data (
188
195
data = file_bytes , mime_type = content_type , path = source
Original file line number Diff line number Diff line change 1
1
[project ]
2
2
name = " Cheshire-Cat"
3
3
description = " Production ready AI assistant framework"
4
- version = " 2.1.2 "
4
+ version = " 2.1.3 "
5
5
requires-python = " >=3.11"
6
6
license = { file = " LICENSE" }
7
7
authors = [
You can’t perform that action at this time.
0 commit comments