Skip to content

Commit

Permalink
fix 'NoneType' and new ContentType supported. (langgenius#4818)
Browse files Browse the repository at this point in the history
  • Loading branch information
lichengwu authored and dengpeng committed Jun 16, 2024
1 parent 1bcec67 commit 32e2b76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/core/rag/extractor/extract_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from extensions.ext_storage import storage
from models.model import UploadFile

SUPPORT_URL_CONTENT_TYPES = ['application/pdf', 'text/plain']
SUPPORT_URL_CONTENT_TYPES = ['application/pdf', 'text/plain', 'application/json']
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"


Expand Down
2 changes: 1 addition & 1 deletion api/core/tools/utils/web_reader_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_url(url: str, user_agent: str = None) -> str:
if content_type:
main_content_type = response.headers.get('Content-Type').split(';')[0].strip()
else:
content_disposition = response.headers.get('Content-Disposition')
content_disposition = response.headers.get('Content-Disposition', '')
filename_match = re.search(r'filename="([^"]+)"', content_disposition)
if filename_match:
filename = unquote(filename_match.group(1))
Expand Down

0 comments on commit 32e2b76

Please sign in to comment.