mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 10:50:24 +00:00
repo commit fix (#3658)
This commit is contained in:
@@ -61,7 +61,7 @@ class RepoCommitDirView(APIView):
|
|||||||
|
|
||||||
commit = seafile_api.get_commit(repo.id, repo.version, commit_id)
|
commit = seafile_api.get_commit(repo.id, repo.version, commit_id)
|
||||||
if not commit:
|
if not commit:
|
||||||
error_msg = 'Commit %s not found.' % commit
|
error_msg = 'Commit %s not found.' % commit_id
|
||||||
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
|
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
|
||||||
|
|
||||||
dir_id = seafile_api.get_dir_id_by_commit_and_path(repo_id, commit_id, path)
|
dir_id = seafile_api.get_dir_id_by_commit_and_path(repo_id, commit_id, path)
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
from rest_framework.authentication import SessionAuthentication
|
from rest_framework.authentication import SessionAuthentication
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
@@ -41,7 +42,7 @@ class RepoCommitRevertView(APIView):
|
|||||||
|
|
||||||
commit = seafile_api.get_commit(repo.id, repo.version, commit_id)
|
commit = seafile_api.get_commit(repo.id, repo.version, commit_id)
|
||||||
if not commit:
|
if not commit:
|
||||||
error_msg = 'Commit %s not found.' % commit
|
error_msg = 'Commit %s not found.' % commit_id
|
||||||
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
|
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
|
||||||
|
|
||||||
# permission check
|
# permission check
|
||||||
@@ -56,7 +57,7 @@ class RepoCommitRevertView(APIView):
|
|||||||
is_decrypted = False if ret == 0 else True
|
is_decrypted = False if ret == 0 else True
|
||||||
|
|
||||||
if not is_decrypted:
|
if not is_decrypted:
|
||||||
error_msg = 'Permission denied.'
|
error_msg = _('This library has not been decrypted.')
|
||||||
return api_error(status.HTTP_403_FORBIDDEN, error_msg)
|
return api_error(status.HTTP_403_FORBIDDEN, error_msg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@@ -7,7 +7,7 @@ from seaserv import seafile_api
|
|||||||
from seahub.test_utils import BaseTestCase
|
from seahub.test_utils import BaseTestCase
|
||||||
|
|
||||||
|
|
||||||
class RepoCommitDirTest(BaseTestCase):
|
class RepoCommitRevertTest(BaseTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.user_name = self.user.username
|
self.user_name = self.user.username
|
||||||
|
Reference in New Issue
Block a user