From c5f577c04f7cc81a67f827280c935f986d83e0f3 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 15 Nov 2021 18:07:46 +0100 Subject: [PATCH] Fix 'Missing credentials parameter' bug : request.POST is buggy when value contains special chars ... request.params appears to be more reliable --- moulinette/interfaces/api.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/moulinette/interfaces/api.py b/moulinette/interfaces/api.py index 9350c76e..1a60e44f 100644 --- a/moulinette/interfaces/api.py +++ b/moulinette/interfaces/api.py @@ -393,14 +393,11 @@ class _ActionsMapPlugin(object): """ - credentials = request.POST.credentials - # Apparently even if the key doesn't exists, request.POST.foobar just returns empty string... - if not credentials: + if "credentials" not in request.params: raise HTTPResponse("Missing credentials parameter", 400) + credentials = request.params["credentials"] - profile = request.POST.profile - if not profile: - profile = self.actionsmap.default_authentication + profile = request.params.get("profile", self.actionsmap.default_authentication) authenticator = self.actionsmap.get_authenticator(profile)