Extensions: Should storage-resize-images delete the original image if the resize fails?

Created on 19 Oct 2020  路  4Comments  路  Source: firebase/extensions

[REQUIRED] Step 2: Extension name

This feature request is for extension: storage-resize-images

What feature would you like to see?

Right now, if the DELETE_ORIGINAL_FILE param is set to true, storage-resize-images will delete the original image it is resizing even if the resize operation fails. We should consider not deleting the original image if the resize fails.

Pros of this change

If the resize operation fails, at least the original image still exists, so it could potentially be used in place of a resized image.

Cons of this change

It's a breaking change - people that use the extension currently may expect and want the original images to be deleted no matter what.

feature request

Most helpful comment

One sneaky way to try to make this backwards compatible would be to change DELETE_ORIGINAL_FILE into a SELECT param instead that accepts true (always delete), false (never delete), and on_success (when resizing was successful). This would preserve behavior for existing values but open up the ability to delete on success without introducing an additional param...

All 4 comments

I propose we change the behavior of DELETE_ORIGINAL_FILE: true to not delete the original image if resize fails. When we release this change, we can mark it as a breaking change.

My original idea was in the case that the DELETE_ORIGINAL_FILE param is set to true, an additional layer of configuration is allowed where you can toggle whether or not the file is deleted on failure - if this is possible at all. That way we can keep the default state while enabling this new feature.

One sneaky way to try to make this backwards compatible would be to change DELETE_ORIGINAL_FILE into a SELECT param instead that accepts true (always delete), false (never delete), and on_success (when resizing was successful). This would preserve behavior for existing values but open up the ability to delete on success without introducing an additional param...

@mbleigh that's a great idea! Let's do that.

@ryqndev thanks for the original proposal!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keatonwalker picture keatonwalker  路  6Comments

giammin picture giammin  路  3Comments

marvinsxtr picture marvinsxtr  路  6Comments

yahavt picture yahavt  路  3Comments

dfischer picture dfischer  路  3Comments