What's the breaking change of 1.7.0?

default discord avatar
Stupidismlast year
1 2

As it is.

  • Selected Answer
    discord user avatar
    JessChowdhury
    last year

    Our last breaking change was in 1.6.1, if you are using version 1.6.0 or older, here are the details of changes and how to migrate.

    While 1.7.0 is not considered a breaking change, it is worth noting that we added additional validation to the following queries:

    1. When the user does not have access to the field being queried
    2. When the field being queried on does not exist

    Either scenario will now result in an error being thrown, you can read more about the why we made this change here.

  • default discord avatar
    lilnoteslast year

    Hello @JessChowdhury!
    I previously used "payload": "1.6.32" and attempted to replace it with the next "payload": "1.7.0". However, I encountered an issue with access control in one of my collections.

    This collections contains upload field asset.
    We only return files with permitted extensions for one of the user roles.

    I use something like access: accessFunction, in collection

    Where accessFunction has this part of code ('en' is default locale,${locale} is current locale from the query)

    ..
          const suitableFileExtensions = {
            or: [
              { 'asset.filename': { contains: '.ext1' } },
              { 'asset.filename': { contains: '.ext1' } },
            ],
          }
         const suitableFileExtensionsInEnLocale = {
            and: [
              {
                or: [
                  { [`asset.en.filename`]: { contains: '.ext1' } },
                  { [`asset.en.filename`]: { contains: '.ext2' } },
                ],
              },
              { [`asset.${locale}`]: { exists: false } },
            ],
          }
    
    ...
      return {
            or: [suitableFileExtensions, suitableFileExtensionsInEnLocale],
      }
    

    Do you have any idea which part of this release could potentially affect it?

    UPD: another strange thing that when I replace extension with filename without extension - it works, for example:
    I have asset with full name myasset.ext1
    If I use condition {['asset.en.url']: { contains: '.ext1' }} it returns nothing
    But if I write {['asset.en.url']: { contains: 'myasset' }} it returns the correct result

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.