From f6a9afce9021083c2e442d5d2a4227459986ad26 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 14 Jul 2015 11:34:45 +0300 Subject: [PATCH 1/2] Change abort to NotFound so it is properly formatted into JSON --- endpoints/api/tag.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endpoints/api/tag.py b/endpoints/api/tag.py index 4cdee1feb..c7fa8c805 100644 --- a/endpoints/api/tag.py +++ b/endpoints/api/tag.py @@ -27,7 +27,7 @@ class ListRepositoryTags(RepositoryParamResource): def get(self, args, namespace, repository): repo = model.get_repository(namespace, repository) if not repo: - abort(404) + raise NotFound() def tag_view(tag): tag_info = { From 1c5300e43903547c0037e75186dc5ffc7aeea1dc Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 14 Jul 2015 11:35:04 +0300 Subject: [PATCH 2/2] We still need to process the function if the auth header is invalid Otherwise, the user gets a 500 --- auth/auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/auth.py b/auth/auth.py index 21ca79748..b664198ca 100644 --- a/auth/auth.py +++ b/auth/auth.py @@ -187,7 +187,7 @@ def process_oauth(func): normalized = [part.strip() for part in auth.split(' ') if part] if normalized[0].lower() != 'bearer' or len(normalized) != 2: logger.debug('Invalid oauth bearer token format.') - return + return func(*args, **kwargs) token = normalized[1] _validate_and_apply_oauth_token(token)