mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-05 09:10:05 +00:00
fix add reviewer&upload image bug
This commit is contained in:
parent
46889e9608
commit
d8dae806e1
@ -94,6 +94,22 @@ class EditorUtilities {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uploadLocalImage = (imageFile) => {
|
||||||
|
return (
|
||||||
|
seafileAPI.getUploadLink(repoID, dirPath).then((res) => {
|
||||||
|
const uploadLink = res.data + '?ret-json=1';
|
||||||
|
const newFile = new File([imageFile], imageFile.name, {type: imageFile.type});
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('parent_dir', '/');
|
||||||
|
formData.append('relative_path', 'images');
|
||||||
|
formData.append('file', newFile);
|
||||||
|
return seafileAPI.uploadImage(uploadLink, formData);
|
||||||
|
}).then ((res) => {
|
||||||
|
return this._getImageURL(res.data[0].name);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
getFileURL(fileNode) {
|
getFileURL(fileNode) {
|
||||||
var url;
|
var url;
|
||||||
if (fileNode.type === 'file') {
|
if (fileNode.type === 'file') {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# Copyright (c) 2012-2016 Seafile Ltd.
|
# Copyright (c) 2012-2016 Seafile Ltd.
|
||||||
|
import posixpath
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.authentication import SessionAuthentication
|
from rest_framework.authentication import SessionAuthentication
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
@ -86,8 +88,10 @@ class DraftReviewReviewerView(APIView):
|
|||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
uuid = r.origin_file_uuid
|
||||||
|
origin_file_path = posixpath.join(uuid.parent_path, uuid.filename)
|
||||||
# check perm
|
# check perm
|
||||||
if seafile_api.check_permission_by_path(r.origin_repo_id, r.origin_file_path, reviewer) != 'rw':
|
if seafile_api.check_permission_by_path(r.origin_repo_id, origin_file_path, reviewer) != 'rw':
|
||||||
error_msg = _(u'Permission denied.')
|
error_msg = _(u'Permission denied.')
|
||||||
result['failed'].append({
|
result['failed'].append({
|
||||||
'email': reviewer,
|
'email': reviewer,
|
||||||
|
Loading…
Reference in New Issue
Block a user