1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-26 07:22:34 +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) { getSearchFilesByFilename(query, page, per_page, search_type) {
const docUuid = this.getDocUuid(); const docUuid = this.getDocUuid();
const accessToken = this.accessToken; 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}` } }); return axios.get(url, { headers: { Authorization: `Token ${accessToken}` } });
} }

View File

@@ -2961,6 +2961,8 @@ class SeadocSearchFilenameView(APIView):
suffixes = ['mp4', 'ogv', 'webm', 'mov',] suffixes = ['mp4', 'ogv', 'webm', 'mov',]
if search_type == 'exdraw': if search_type == 'exdraw':
suffixes = ['exdraw',] suffixes = ['exdraw',]
if search_type == 'image':
suffixes = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'webp']
if not suffixes: if not suffixes:
error_msg = 'search_type is not valid.' error_msg = 'search_type is not valid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)