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: avoid metadata mutation in fPutObject #815

Merged
merged 1 commit into from
Nov 22, 2019

Conversation

ThisIsOstad
Copy link
Contributor

@ThisIsOstad ThisIsOstad commented Nov 20, 2019

Consider the following code:

const metadata = {
  some: 'thing',
};

for (const file of files) {
  client.fPutObject(bucketName, objectName, file, metadata, callback);
}

The problem with this code is that it mutates the metadata object. After the first iteration the object contains the 'content-type' property. What follows is the wrong 'content-type' being set on the remaining files.

I solved the problem by creating a new object instead of mutating the original one.

Copy link
Contributor

@kaankabalak kaankabalak left a comment

Choose a reason for hiding this comment

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

LGTM, thank you very much for the contribution @MoradiDavijani!

@kannappanr kannappanr merged commit c5d206e into minio:master Nov 22, 2019
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.

4 participants