Feature Request: Preserve original filename when downloading media attachments #10506
YouJun-IWON
started this conversation in
Ideas
Replies: 1 comment
-
|
Thanks for raising this! Could you please retry your PPTX upload with Langfuse Cloud? We have recently shipped improvements to media handling incl PPTX that should lead to a correct file extension (while the file name is still the media ID) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature or potential improvement
Feature Description
When uploading files using
LangfuseMedia, the original filename is lost during S3 storage, causing downloads to use the media ID with a.binextension instead of the original filename.Current Behavior
Upload:
from langfuse import get_client
from langfuse.media import LangfuseMedia
langfuse_client = get_client()
Upload a PowerPoint file
with open("presentation.pptx", "rb") as f:
file_bytes = f.read()
pptx_media = LangfuseMedia(
content_bytes=file_bytes,
content_type="application/vnd.openxmlformats-officedocument.presentationml.presentation"
)
langfuse_client.update_current_trace(
input={
"presentation.pptx": pptx_media,
},
metadata={
"file_info": {
"filename": "presentation.pptx",
"size_mb": 2.5
}
}
)Result:
WY7P2DC7gRxnrTRg0dp3Be.bininstead ofpresentation.pptxExpected Behavior
When downloading a media attachment from the Langfuse UI, the file should be downloaded with:
presentation.pptx.pptx(not.bin)Proposed Solution
Add a
filenameparameter to theLangfuseMediaclass:LangfuseMedia(
content_bytes=file_bytes,
content_type="application/pdf",
filename="document.pdf" # ✨ New parameter
)This filename should be:
Content-Dispositionheader when serving download linksUse Cases
This feature is critical for:
Current Workaround
We currently store the filename in metadata, but this requires users to:
.binfileAdditional Context
Benefits
Are you willing to contribute?
Yes, I can contribute a PR if provided with guidance on:
filenameparameter in the SDKThank you for considering this feature request! 🙏
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions