Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage-resizes-images) Fixes issue where resized image is not rendered in Firebase Console (Issue #140) #279

Merged
merged 5 commits into from
Apr 23, 2020

Conversation

sitefinitysteve
Copy link
Contributor

The problem with the current extension is outlined here

This should add a new configuration option to NOT delete the token, defaults to true to preserve existing functionality, users can go in to disable it if they don't want it happening.

@googlebot googlebot added the cla: yes Author has signed the CLA label Apr 22, 2020
@laurenzlong laurenzlong added the in-review Awaiting review by FE team. label Apr 22, 2020
@laurenzlong laurenzlong requested a review from a team April 22, 2020 18:05
@laurenzlong
Copy link
Contributor

@firebase/invertase Can you verify that this works? If the option is set to "false" then does it allow the resized image to be downloaded? If yes, then it seems that this should not be a param, but the download token should just always be preserved, and we would make a minor version bump.

@sitefinitysteve
Copy link
Contributor Author

sitefinitysteve commented Apr 22, 2020

No, well I mean right now you cant download the resized images, so defaulting to false I assumed would not break existing configurations for users who have it working this way now and for some reason want it like that?

I agree 100%, it shouldn't be a param, and the delete command should just go away honestly... but I didn't want to rock the boat.

Like I can't for the life of my understand why this is here

delete metadata.metadata.firebaseStorageDownloadTokens;

Wouldn't it be the inverse, more people would want that access token there so the resized image just works?

@laurenzlong
Copy link
Contributor

No, well I mean right now you cant download the resized images, so defaulting to false I assumed would not break existing configurations for users who have it working this way now and for some reason want it like that?

I agree 100%, it shouldn't be a param, and the delete command should just go away honestly... but I didn't want to rock the boat.

Like I can't for the life of my understand why this is here

delete metadata.metadata.firebaseStorageDownloadTokens;

Wouldn't it be the inverse, more people would want that access token there so the resized image just works?

That's why I suggested a minor version bump, which for versions under 1.0.0 indicates a breaking change. (I think this is worth doing a breaking change for, rather than adding an unnecessary param)

@sitefinitysteve
Copy link
Contributor Author

Ok, so if I have the blessing... remove the param and delete entirely, bump to 0.2.0? Sound good?

@laurenzlong
Copy link
Contributor

@sitefinitysteve Yes please, also you do not have to increment the version or add to the changelog in this PR, that gets automatically generated later when we do the release. Thanks for your contribution!

@laurenzlong laurenzlong changed the title Make deletion of the access tokens for newly resized images optional fix(storage-resizes-images) Fixes issue where resized image is inaccessible through a download URL (Issue #140) Apr 22, 2020
@laurenzlong laurenzlong changed the title fix(storage-resizes-images) Fixes issue where resized image is inaccessible through a download URL (Issue #140) fix(storage-resizes-images) Fixes issue where resized image is not rendered in Firebase Console (Issue #140) Apr 22, 2020
@@ -161,7 +164,6 @@ const resizeImage = ({ bucket, originalFile, fileDir, fileNameWithoutExtension,
else {
metadata.cacheControl = objectMetadata.cacheControl;
}
delete metadata.metadata.firebaseStorageDownloadTokens;
// Generate a resized image using Sharp.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah of course, line 164 the source of all our pain. :-)

@russellwheatley
Copy link
Member

Hey @laurenzlong, I can confirm that this works.

This is a resized image before the change is made. As you can see there is no image displayed because it need a new token creating:
Screenshot 2020-04-23 at 10 12 40

This is a resized image after the change. Image is displayed because the token is preserved:
Screenshot 2020-04-23 at 10 10 54

Copy link
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sitefinitysteve
Copy link
Contributor Author

I mean i've been using this fix by editing the cloud function directly for a few weeks, but new releases keep blowing away the edit, I know she works.

On that note, what's the release schedule like for something like this?

@laurenzlong
Copy link
Contributor

Thanks @sitefinitysteve and @russellwheatley! This is failing the linter, could you please fix by running npm run format?

We can slot this in for the May 7 release.

@sitefinitysteve
Copy link
Contributor Author

Done, thanks @laurenzlong and team, this saved me big time!

@laurenzlong
Copy link
Contributor

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Author has signed the CLA in-review Awaiting review by FE team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants