prismicio-community/ruby-kit

Bug: Release without description causes error in Prismic Ruby client

Closed this issue · 2 comments

If you create a Release without a description, which is possible by Publishing a document and choosing "Publish at a specific date and time", the ref returned by Prismic's API will have a null label and the Prismic client will fail to parse the entire response.

https://github.com/prismicio-community/ruby-kit/blob/1.7.0/lib/prismic/api.rb#L222

Found this in version 1.7.0, but still appears to be an issue on master. This line will fail with a "NoMethodError: undefined method `downcase' for nil:NilClass" ruby-kit/api.rb at 1.7.0 · prismicio-community/ruby-kit · GitHub 1

Versions

  • ruby-kit:
  • gem version:

Reproduction

Additional Details

https://community.prismic.io/t/release-without-description-causes-error-in-prismic-ruby-client/7514


Steps to reproduce

What is Expected?

What is actually happening?

I don't know Ruby, but basically, I think the fix would be something like this ref['label'].nil ? nil : ref['label']. downcase

ref['label']?.downcase

would be enough