File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
ui/src/components/ai-chat/component/knowledge-source-component Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 11# coding=utf-8
2+ import urllib
23
34import uuid_utils .compat as uuid
45from django .db .models import QuerySet
@@ -94,9 +95,10 @@ def get(self, with_valid=True):
9495 raise NotFound404 (404 , _ ('File not found' ))
9596 file_type = file .file_name .split ("." )[- 1 ].lower ()
9697 content_type = mime_types .get (file_type , 'application/octet-stream' )
98+ encoded_filename = urllib .parse .quote (file .file_name )
9799 headers = {
98100 'Content-Type' : content_type ,
99- 'Content-Disposition' : f'{ "inline" if file_type == "pdf" else "attachment" } ; filename=" { file . file_name } " '
101+ 'Content-Disposition' : f'{ "inline" if file_type == "pdf" else "attachment" } ; filename={ encoded_filename } '
100102 }
101103 return HttpResponse (
102104 file .get_bytes (),
Original file line number Diff line number Diff line change 2727 </div >
2828 <div class =" ml-8" v-else >
2929 <a
30- :href =" getFileUrl(item?.meta?.source_file_id)"
30+ :href =" getFileUrl(item?.meta?.source_file_id || item?.source_url )"
3131 target =" _blank"
3232 class =" ellipsis-1"
3333 :title =" item?.document_name?.trim()"
You can’t perform that action at this time.
0 commit comments