8000 @uppy-example/aws-nodejs: fix fileType not present in S3 objects by qxprakash · Pull Request #5680 · transloadit/uppy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

@uppy-example/aws-nodejs: fix fileType not present in S3 objects #5680

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

Merged
merged 2 commits into from
Mar 31, 2025

Conversation

qxprakash
Copy link
Collaborator
@qxprakash qxprakash commented Mar 9, 2025

Fixes #5666

@Murderlon while trying to reproduce and I came across this bug , where uploading a file from the example code provided at examples/aws-nodejs/public/index.html
resulted in uploaded files with undefined_name in instead of fileName in the S3 key as well as no fileType present

reference -

image

this was because while making the request to /s3/params to get the signed URL , it parses the fileName and contentType from the request body to append it to the Key

const signOnServer = (req, res, next) => {
// Before giving the signature to the user, you should first check is they
// are authorized to perform that operation, and if the request is legit.
// For the sake of simplification, we skip that check in this example.
const Key = `${crypto.randomUUID()}-${req.body.filename}`
const { contentType } = req.body
getSignedUrl(
getS3Client(),
new PutObjectCommand({
Bucket: process.env.COMPANION_AWS_BU 8000 CKET,
Key,
ContentType: contentType,
}),

but in default case (without the customEndpoint) it's a GET request which causes this error as we're trying to parse the fileName and contentType from req body ,

const query = new URLSearchParams({ filename, type, ...metadata } as Record<
string,
string
>)
return this.#client.get(`s3/params?${query}`, options)
}

After :

image

File uploaded with correct fileName and correct fileType

@qxprakash qxprakash marked this pull request as ready for review March 9, 2025 22:44
@qxprakash
Copy link
Collaborator Author

Hi @Murderlon any feedback on this ?

Copy link
Member
@Murderlon Murderlon left a comment

Choose a reason for hiding this comment

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

If this is only meant to solve #5666 then it looks good. It doesn't solve #5667 as this is example code, not library code.

@qxprakash
Copy link
Collaborator Author

yeah I was not trying to solve #5667 in this PR , it was just a small bug I discovered while testing out the flow for s3 plugin.

@Murderlon Murderlon changed the title fix fileName - undefined and fileType not present in s3 upload objects @uppy-example/aws-nodejs: fix fileType not present in S3 objects Mar 31, 2025
@Murderlon Murderlon merged commit 3d96004 into transloadit:main Mar 31, 2025
4 checks passed
@Murderlon
Copy link
Member

Thanks for the contribution 👌

@github-actions github-actions bot mentioned this pull request Apr 8, 2025
github-actions bot added a commit that referenced this pull request Apr 8, 2025
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/audio                |   2.1.2 | @uppy/locales              |   4.5.2 |
| @uppy/box                  |   3.2.2 | @uppy/onedrive             |   4.2.3 |
| @uppy/companion            |   5.6.0 | @uppy/react                |   4.2.3 |
| @uppy/core                 |   4.4.4 | @uppy/remote-sources       |   2.3.2 |
| @uppy/dashboard            |   4.3.3 | @uppy/screen-capture       |   4.2.2 |
| @uppy/drag-drop            |   4.1.2 | @uppy/status-bar           |   4.1.3 |
| @uppy/dropbox              |   4.2.2 | @uppy/transloadit          |   4.2.2 |
| @uppy/facebook             |   4.2.2 | @uppy/unsplash             |   4.3.3 |
| @uppy/file-input           |   4.1.2 | @uppy/url                  |   4.2.3 |
| @uppy/google-drive         |   4.3.2 | @uppy/utils                |   6.1.3 |
| @uppy/google-drive-picker  |   0.3.4 | @uppy/webcam               |   4.1.2 |
| @uppy/google-photos-picker |   0.3.4 | @uppy/webdav               |   0.3.2 |
| @uppy/image-editor         |   3.3.2 | @uppy/zoom                 |   3.2.2 |
| @uppy/instagram            |   4.2.2 | uppy                       |  4.14.0 |

- @uppy/core: dry retryAll() and upload() (Mikael Finstad / #5691)
- @uppy/angular: Revert "Support Angular 19" (Mikael Finstad / #5710)
- @uppy/angular: Support Angular 19 (Arnaud Flaesch / #5709)
- @uppy/companion: implement dropbox business teams (Mikael Finstad / #5708)
- @uppy/utils: add msg mimetype (Merlijn Vos / #5699)
- @uppy/core: fix locale type for plugins (Merlijn Vos / #5700)
- examples: build(deps-dev): bump vite from 5.4.14 to 5.4.15 (dependabot[bot] / #5703)
- @uppy/locales: Update nb_NO.ts (Tore Sinding Bekkedal / #5678)
- meta: build(deps): bump docker/login-action from 3.3.0 to 3.4.0 (dependabot[bot] / #5689)
- examples: @uppy-example/aws-nodejs: fix fileType not present in S3 objects (Prakash / #5680)
- @uppy/core: fix events when retrying with upload() (Prakash / #5696)
- meta: Fix locales building (Mikael Finstad / #5693)
- @uppy/google-photos: remove google photos 😢 (Mikael Finstad / #5690)
- @uppy/locales: Update cs_CZ.ts (David Petrásek / #5658)
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.

AwsS3 multipart with custom endpoints doesn't work with files <5 mb
2 participants
0