1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-08 02:10:24 +00:00

repo commit fix (#3658)

This commit is contained in:
sniper-py
2019-06-14 16:01:33 +08:00
committed by lian
parent c41e4b04fa
commit 875d5b6ded
3 changed files with 5 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ class RepoCommitDirView(APIView):
commit = seafile_api.get_commit(repo.id, repo.version, commit_id)
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)
dir_id = seafile_api.get_dir_id_by_commit_and_path(repo_id, commit_id, path)

View File

@@ -3,6 +3,7 @@
import logging
from django.utils.translation import ugettext as _
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
@@ -41,7 +42,7 @@ class RepoCommitRevertView(APIView):
commit = seafile_api.get_commit(repo.id, repo.version, commit_id)
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)
# permission check
@@ -56,7 +57,7 @@ class RepoCommitRevertView(APIView):
is_decrypted = False if ret == 0 else True
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)
try:

View File

@@ -7,7 +7,7 @@ from seaserv import seafile_api
from seahub.test_utils import BaseTestCase
class RepoCommitDirTest(BaseTestCase):
class RepoCommitRevertTest(BaseTestCase):
def setUp(self):
self.user_name = self.user.username