Skip to content
This repository has been archived by the owner on Aug 7, 2022. It is now read-only.

add args even with attachment #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michaeleekk
Copy link

Without this commit, the filename can't be set to name other than the original file name.
But still, there is some issue setting the mimeType.

@adunkman
Copy link
Owner

This seems really shotgunny — in that it seems like you’d accidentally send a bunch of useless stuff (since you’re copying every key over from the arguments). Is there an approach that’s more targeted?

@michaeleekk
Copy link
Author

After some trials and errors, it seems the best way is to set the filename with extension and set with attachment. Even though explicitly setting the name and mimeType, Trello won't help me generating an image preview, if my filename is like upload_3456789 instead of image.png with the correct extension.

My situation is, when I did a form upload to my node server with koa-body module, it will generate a filename with random string. If I applied this commit and send the request with,

{
  "attachment": file,
  "name": "abc.png",
  "mimeType": file.type,
}

I can set the display name to abc.png. But it won't, 1. generate an image preview and 2. when downloading the file, it's not abc.png but the random string generated by the module.

My best workaround is renaming the temporary file to abc.png.

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

Successfully merging this pull request may close these issues.

None yet

2 participants