Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker/nginx/ragflow.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ server {
gzip_vary on;
gzip_disable "MSIE [1-6]\.";

location ~ ^/api/v1/admin {
proxy_pass http://localhost:9381;
include proxy.conf;
}

location ~ ^/(v1|api) {
proxy_pass http://localhost:9380;
include proxy.conf;
Expand Down
25 changes: 19 additions & 6 deletions rag/flow/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,27 @@ def _email(self, name, blob):
if "body" in target_fields:
body_text, body_html = [], []
def _add_content(m, content_type):
def _decode_payload(payload, charset, target_list):
try:
target_list.append(payload.decode(charset))
except (UnicodeDecodeError, LookupError):
for enc in ["utf-8", "gb2312", "gbk", "gb18030", "latin1"]:
try:
target_list.append(payload.decode(enc))
break
except UnicodeDecodeError:
continue
else:
target_list.append(payload.decode("utf-8", errors="ignore"))

if content_type == "text/plain":
body_text.append(
m.get_payload(decode=True).decode(m.get_content_charset())
)
payload = msg.get_payload(decode=True)
charset = msg.get_content_charset() or "utf-8"
_decode_payload(payload, charset, body_text)
elif content_type == "text/html":
body_html.append(
m.get_payload(decode=True).decode(m.get_content_charset())
)
payload = msg.get_payload(decode=True)
charset = msg.get_content_charset() or "utf-8"
_decode_payload(payload, charset, body_html)
elif "multipart" in content_type:
if m.is_multipart():
for part in m.iter_parts():
Expand Down