From 8e0228b64c11e10a29e2c9589fa3cc94a8209de5 Mon Sep 17 00:00:00 2001 From: Fahim Ali Zain Date: Fri, 23 Apr 2021 01:33:32 +0530 Subject: [PATCH] fix: multipart/form-data breaks with OAuth tokens --- frappe/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frappe/api.py b/frappe/api.py index 4a120f228a..9039ae0e5f 100644 --- a/frappe/api.py +++ b/frappe/api.py @@ -177,8 +177,10 @@ def validate_oauth(authorization_header): access_token = {"access_token": token} uri = parsed_url.scheme + "://" + parsed_url.netloc + parsed_url.path + "?" + urlencode(access_token) http_method = req.method - body = req.get_data() headers = req.headers + body = req.get_data() + if req.content_type and "multipart/form-data" in req.content_type: + body = None try: required_scopes = frappe.db.get_value("OAuth Bearer Token", token, "scopes").split(get_url_delimiter())