Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ed55c677

Přidáno uživatelem Jan Pašek před téměř 4 roky(ů)

Re #8475 - Fixed minor bug in GET /api/certificates endpoint with filtering

Zobrazit rozdíly:

src/controllers/certificates_controller.py
1
import json
1 2
from datetime import datetime
2 3
from itertools import chain
3 4
from flask import request
......
214 215
        CertController.setup()                                                      # TODO remove after issue fixed
215 216

  
216 217
        targets = {ROOT_CA_ID, INTERMEDIATE_CA_ID, CERTIFICATE_ID}                  # all targets
217
        if request.is_json:                                                         # if the request carries JSON data
218
            data = request.get_json()                                               # get it
218

  
219
        # the filtering parameter can be read as URL argument or as a request body
220
        if request.is_json or "filtering" in request.args.keys():                   # if the request carries JSON data
221
            if request.is_json:
222
                data = request.get_json()                                           # get it
223
            else:
224
                data = {"filtering": json.loads(request.args["filtering"])}
219 225
            if FILTERING in data:                                                   # if the 'filtering' field exists
220 226
                if isinstance(data[FILTERING], dict):                               # and it is also a 'dict'
221 227
                    if CA in data[FILTERING]:                                       # containing 'CA'

Také k dispozici: Unified diff