1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 06:33:48 +00:00

add search feat (#8257)

Co-authored-by: 小强 <shuntian@Mac.lan>
This commit is contained in:
杨顺强
2025-09-24 11:05:34 +08:00
committed by GitHub
parent 421fe7617f
commit 65619f3960
2 changed files with 5 additions and 3 deletions

View File

@@ -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}` } });
}

View File

@@ -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)