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

Make opts.hostedPath (and installation) respect the s3ForcePathStyle param #608

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jared-duo
Copy link

@jared-duo jared-duo commented Sep 22, 2021

This is an example of a potential fix for issue #607.

I'm sure I may be doing something non-idiomatically as I do not code for NodeJS too often. Also guessing that the CHANGELOG and package version will need incremented appropriately if this is actually something that node-pre-gyp would like to do (and I'm not missing something.)

@@ -33,6 +32,10 @@ module.exports.detect = function(opts, config) {
}
}
}
// If we are using s3ForcePathStyle the bucket is part of the http object path
// (but not the S3 key prefix path). If we aren't this isn't as much of a consideration.
const bucket_path = config.s3ForcePathStyle ? `/${config.bucket}/` : '/';
Copy link
Author

@jared-duo jared-duo Oct 4, 2021

Choose a reason for hiding this comment

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

Moving this below the if/else structure does skip an early return on line 21. I think that early return is acting in light of an error condition so not having config.prefix set for it is fine, but I'm not 100% sure.

@springmeyer
Copy link
Contributor

Hi @jared-duo - thank you for this contribution. Looks totally reasonable to me. Have you confirmed/been able to test that it fixes the original issue? If so, can you think of a way to add a test to the unit tests to ensure this does not regress ever in the future?

@jared-duo
Copy link
Author

I have verified that this works for my use case. (Using the forked repo currently.)

I'll TAL at the unit tests as soon as I can and see if I can come up with a reasonable way to test this - hopefully in the next week or so.

Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants