JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

BUG: malformed includes raises NoMethodError

Offen
#1,376 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Ruby
Sterne
2.3k
Forks
546
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

This issue is a (choose one):

  • Problem/bug report.
  • Feature request.
  • Request for support. Note: Please try to avoid submitting issues for support requests. Use Gitter instead.

Checklist before submitting:

  • I've searched for an existing issue.
  • I've asked my question on Gitter and have not received a satisfactory answer.
  • I've included a complete bug report template. This step helps us and allows us to see the bug without trying to reproduce the problem from your description. It helps you because you will frequently detect if it's a problem specific to your project.
  • The feature I'm asking for is compliant with the JSON:API spec.

Description

Choose one section below and delete the other:

Bug reports:

The CSV gem raises a NoMethodError when passed an array

e.g. CSV.parse_line(["memberships"]) raises

private method `gets' called for ["memberships"]:Array

And JR in 0.9.x and 0.10.x in a few places uses CSV.parse_line but only rescues CSV::MalformedCSVError

making a request like v1/users/:id?include[]=memberships with call e.g. JSONAPI::RequestParser#parse_include_directives with ["memberships"] and raise an unhandled error.

My proposal is 1) encapsulate wherever CSV.parse_line is called and 2) ensure any errors are handled and raises as JSONAPI::Exceptions

I could possibly make PRs to 0.9 and 0.10

(We're still on 0.9 due to bugs changes in handling of polymorphic types and plain old resources, but I'd like to help however I can)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne bei JSONAPI::RequestParser#parse_include_directives und verfolge die Stellen, an denen CSV.parse_line in den Codepfaden 0.9 und 0.10 aufgerufen wird. Reproduziere die Array-Eingabe aus include[]=memberships, und überprüfe anschließend, dass fehlerhafte Eingaben keinen unbehandelten NoMethodError mehr auslösen und als ein Fehler von JSONAPI::Exceptions gemeldet werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ruby
Bereich
api
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.