From 65619f39600828967ec72851a1de7b5a147be0c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=A1=BA=E5=BC=BA?= <978987373@qq.com> Date: Wed, 24 Sep 2025 11:05:34 +0800 Subject: [PATCH] add search feat (#8257) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 小强 --- frontend/src/pages/excalidraw-editor/context.js | 2 +- seahub/seadoc/apis.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/excalidraw-editor/context.js b/frontend/src/pages/excalidraw-editor/context.js index 59c9928ce1..37d65ad7af 100644 --- a/frontend/src/pages/excalidraw-editor/context.js +++ b/frontend/src/pages/excalidraw-editor/context.js @@ -78,7 +78,7 @@ class Context { getSearchFilesByFilename(query, page, per_page, search_type) { const docUuid = this.getDocUuid(); const accessToken = this.accessToken; - const url = 'api/v2.1/seadoc/search-filename/' + docUuid + '/?query=' + query + '&page=' + page + '&per_page=' + per_page + '&search_type=' + search_type; + const url = server + '/api/v2.1/seadoc/search-filename/' + docUuid + '/?query=' + query + '&page=' + page + '&per_page=' + per_page + '&search_type=' + search_type; return axios.get(url, { headers: { Authorization: `Token ${accessToken}` } }); } diff --git a/seahub/seadoc/apis.py b/seahub/seadoc/apis.py index 631272b49c..57903ba94f 100644 --- a/seahub/seadoc/apis.py +++ b/seahub/seadoc/apis.py @@ -550,7 +550,7 @@ class SeadocUploadVideo(APIView): relative_path = [] for file in file_list: file_path = posixpath.join(parent_path, file.name) - file_path = os.path.normpath(file_path) + file_path = os.path.normpath(file_path) files = {'file': file} data = {'parent_dir': parent_path, 'filename': file.name, 'target_file': file_path} resp = requests.post(upload_link, files=files, data=data) @@ -2961,6 +2961,8 @@ class SeadocSearchFilenameView(APIView): suffixes = ['mp4', 'ogv', 'webm', 'mov',] if search_type == 'exdraw': suffixes = ['exdraw',] + if search_type == 'image': + suffixes = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'webp'] if not suffixes: error_msg = 'search_type is not valid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) @@ -3082,7 +3084,7 @@ class SeadocExportView(APIView): response = FileResponse(open(tmp_zip_path, 'rb'), content_type="application/x-zip-compressed", as_attachment=True) - + response['Content-Disposition'] = 'attachment;filename*=UTF-8\'\'' + quote(uuid_map.filename[:-4] + ZSDOC) if wiki_page_name: response['Content-Disposition'] = 'attachment;filename*=UTF-8\'\'' + quote(wiki_page_name[:-4] + ZSDOC)