1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 00:00:00 +00:00

[web-api] Use p and size as args

This commit is contained in:
lian
2015-03-02 14:10:44 +08:00
parent 413761f66d
commit cbb0d34ca1
2 changed files with 7 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ urlpatterns = patterns('',
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/dir/sub_repo/$', DirSubRepoView.as_view()),
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/dir/share/$', DirShareView.as_view()),
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/dir/download/$', DirDownloadView.as_view()),
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/thumbnail/(?P<path>.+)$', ThumbnailView.as_view(), name='api2-thumbnail'),
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/thumbnail/$', ThumbnailView.as_view(), name='api2-thumbnail'),
url(r'^starredfiles/', StarredFileView.as_view(), name='starredfiles'),
url(r'^shared-repos/$', SharedRepos.as_view(), name='sharedrepos'),
url(r'^shared-repos/(?P<repo_id>[-0-9-a-f]{36})/$', SharedRepo.as_view(), name='sharedrepo'),

View File

@@ -3474,7 +3474,7 @@ class ThumbnailView(APIView):
permission_classes = (IsAuthenticated,)
throttle_classes = (UserRateThrottle, )
def get(self, request, repo_id, path):
def get(self, request, repo_id):
repo = get_repo(repo_id)
if not repo:
@@ -3489,10 +3489,14 @@ class ThumbnailView(APIView):
return api_error(status.HTTP_403_FORBIDDEN,
'Thumbnail function is not enabled.')
size = request.GET.get('s', None)
size = request.GET.get('size', None)
path = request.GET.get('p', None)
if size is None:
return api_error(status.HTTP_400_BAD_REQUEST, 'Size is missing.')
if path is None:
return api_error(status.HTTP_400_BAD_REQUEST, 'Path is missing.')
obj_id = get_file_id_by_path(repo_id, path)
if obj_id is None: