Three search parameter forms get an HTTP 500 response or are silently ignored

Abierto
#2,553 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
clojure
Área
api, backend

Línea de trabajo

Start by locating the search parameter parsing and validation code for indexed names, case-insensitive duplicate parameters, and boolean values such as include_granule_counts; the issue does not name files or tests. Reproduce the three examples against the collections and granules search endpoints, then inspect the relevant validation tests. Done when each malformed form returns a 400 naming the parameter, or uppercase TRUE is handled the same as true.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Three search parameter forms get an HTTP 500 response or are silently ignored, where CMR rejects similar forms with a 400 response that names the parameter. The output below is from 2026-12-01.

1. An indexed sort_key is an HTTP 500 response
$ curl -sSg -w ' HTTP %{http_code}\n' 'https://cmr.earthdata.nasa.gov/search/granules.json?short_name=MOD11A2&page_size=0&sort_key[0]=-start_date'
{"errors":["An Internal Error has occurred."]} HTTP 500

Expected: a 400 response that names the parameter, as an indexed short_name gets:

$ curl -sSg -w ' HTTP %{http_code}\n' 'https://cmr.earthdata.nasa.gov/search/granules.json?short_name[0]=MOD11A2&page_size=0'
{"errors":["Parameter [short_name] must have a single value or multiple values."]} HTTP 400
2. A parameter given in both lower case and upper case keeps one value without an error

CMR accepts a parameter name in upper case as well as lower case, and rejects a parameter that takes a single value, such as page_size, when it is given twice. The commands below use a helper that prints the status, then the number of collections or the first error:

search() { curl -sS -w '%{http_code}' "https://cmr.earthdata.nasa.gov/search/collections.json?$1" | jq -rs '"HTTP \(.[1]), " + (.[0].errors[0] // "collections: \(.[0].feed.entry | length)")'; }
$ search 'PAGE_SIZE=2'
HTTP 200, collections: 2
$ search 'page_size=5&page_size=1'
HTTP 400, Parameter [page_size] must have a single value.

Given once in lower case and once in upper case, the parameter keeps one value and drops the other without an error, even when the dropped value is invalid:

$ search 'page_size=5&PAGE_SIZE=1'
HTTP 200, collections: 1
$ search 'PAGE_SIZE=1&page_size=5'
HTTP 200, collections: 5
$ search 'page_size=abc&PAGE_SIZE=1'
HTTP 200, collections: 1

Expected: the same 400 response as for page_size=5&page_size=1.

3. include_granule_counts=TRUE is neither honored nor rejected

include_granule_counts=true adds a granule_count to each collection, and a value such as 1 gets a 400 response. The commands below use a helper that prints the status, then the granule_count of the one collection that matches, or the first error:

counts() { curl -sS -w '%{http_code}' "https://cmr.earthdata.nasa.gov/search/collections.json?short_name=MOD11A2&page_size=1&include_granule_counts=$1" | jq -rs '"HTTP \(.[1]), " + (.[0].errors[0] // "granule_count: \(.[0].feed.entry[0].granule_count)")'; }
$ counts true
HTTP 200, granule_count: 389798
$ counts 1
HTTP 400, Parameter include_granule_counts must take value of true, false, or unset, but was [1]

Given as TRUE or True, the value gets a 200 response without the count:

$ counts TRUE
HTTP 200, granule_count: null
$ counts True
HTTP 200, granule_count: null

Expected: the count, as for true, or the 400 response that 1 gets.

Lenguaje dominante
Clojure
Estrellas
403
Forks
113
Merge medio
3 d 2 h
PR fusionados (30 d)
13

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de nasa/Common-Metadata-Repository

Todos los issues de nasa/Common-Metadata-Repository

Issues similares

Más issues de Clojure

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.