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(medusa-file-s3): Update key formation to use timestamp #3601

Merged
merged 3 commits into from
Mar 28, 2023
Merged

fix(medusa-file-s3): Update key formation to use timestamp #3601

merged 3 commits into from
Mar 28, 2023

Conversation

IgorKhomenko
Copy link
Contributor

medusa-file-s3 plugin overrides a file if upload a file with same name, e.g. 1.jpg.
This is because a file.originalname is used as an S3 object Key.

This PR addresses this issue by introducing more advanced S3 Key formation mechanism, using timestamp value as a part of name, similar to minio/spaces plugins

Original issue #3599

@IgorKhomenko IgorKhomenko requested a review from a team as a code owner March 28, 2023 08:43
@changeset-bot
Copy link

changeset-bot bot commented Mar 28, 2023

⚠️ No Changeset found

Latest commit: e76c1a1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Mar 28, 2023

@IgorKhomenko is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

@@ -32,11 +32,14 @@ class S3Service extends AbstractFileService {
}

uploadFile(file, options = { isProtected: false, acl: undefined }) {
const parsedFilename = parse(file.originalname)
Copy link
Contributor

Choose a reason for hiding this comment

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

You have used parse but it will be undefined I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added missing import

Copy link
Member

@adrien2p adrien2p left a comment

Choose a reason for hiding this comment

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

LGTM

@vercel
Copy link

vercel bot commented Mar 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
medusa-docs 🛑 Canceled (Inspect) Mar 28, 2023 at 10:43AM (UTC)

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @IgorKhomenko !

@olivermrbl olivermrbl merged commit b6c08cb into medusajs:develop Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants