Hi, I am trying to use the Dynamic

Hi, I am trying to use the DynamicFileDownloader in a context menu but instead of the intended content it downloads the html content of the page.

Do you think it will just not work in a context menu? Or is there a way to fix it?

I used a very simple code:

TextArea textArea =  = new TextArea();
textArea.setSizeFull();
addAndExpand(textArea);

ContextMenu contextMenu = new ContextMenu(textArea);

DynamicFileDownloader dynamicFileDownloader = new DynamicFileDownloader(“Download”, null, outputStream -> {
try {
outputStream.write(textArea.getValue().getBytes());
} catch (IOException e) {
e.printStackTrace();
}
}) {
@Override
protected String getFileName(VaadinSession session, VaadinRequest request) {
return LocalDateTime.now() + “foobar.txt”;
}
};
contextMenu.addItem(dynamicFileDownloader);

Tested and that happens indeed. Weird error. Might be related to how the context menu works attaching/reattaching components in it. Quickly looking FileDownloader registers the "resource" in constructor, and removes it on detach -> on reattach it is probably broken. Probably an easy fix. I can try to check later today.

Fixed, version 2.1.3 should appear central within a half an hour.