Skip to content

CodeBlockDownloadButton: filename/MIME not overridable (always file.<ext>, table download has filename — code doesn't) #558

Description

@hrminator

Summary

In 2.5.0 the code-block download button hardcodes its output filename to file.<ext> (extension derived from the language). There's no prop to override the filename or MIME type on the built-in button — while the table chrome's TableDownloadButton DOES accept a filename prop, so the API is inconsistent between the two download surfaces.

Hosts rendering assistant answers usually have better naming context available (conversation title, block index, a model-suggested name from code-fence meta) and end up disabling the download control rather than shipping file.py downloads.

Suggested fix

  • Add filename (and optionally mimeType) to CodeBlockDownloadButton, mirroring TableDownloadButton.
  • For the default-rendered controls, accept it via the controls config (e.g. controls={{code:{download:{filename: (lang, code) => string}}}}) or read it from code-fence meta (```python title=example.py).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions