payload icon indicating copy to clipboard operation
payload copied to clipboard

fix(storage-s3): Do not generate file url when filename does not exist

Open mikecebul opened this issue 1 year ago • 0 comments

What?

generateFileURL() can return null if the filename does not exist.

Why?

By default, the image size will return NULL when the uploaded image is smaller than the defined image size. Use the withoutEnlargement prop to change this. Docs: image sizes defaults

The result is an image size object like this:

portrait: {
  width: null,
  height: null,
  mimeType: null,
  filesize: null,
  filename: null,
  url: 'https://bucket.example.com/media/null' 
},

How?

Since the plugin-cloud-storage are closely related, I updated both generateURL() to return null if filename === null. Notice the type error is not easily seen without the tsconfig setting:

"compilerOptions": {
  "strictNullChecks": true
}

Fixes #9095

mikecebul avatar Nov 28 '24 18:11 mikecebul