FlowUI 1.5 + REST = broken upload (test project included)

upload-bug.zip (386.5 KB)

Steps to reproduce: (not needed with attached test project)

  • create new FlowUI project
  • add REST API addon from marketplace
  • add a upload field (doesn’t matter which one) to the UserDetailView
  • inject it into the controller and add a FileUploadSucceededListener
  • listener is never called.

As a counter check remove the REST API addon

  • listener is correctly called upon file upload

This bug drove me nuts already. :sweat_smile: Some insight I got already: With the REST API the upload request is missing the parts. See also com.vaadin.flow.server.communication.StreamReceiverHandler#doHandleMultipartFileUpload
The hasParts(request) is true when it is working, but false when it isn’t.

I’m guessing there is some faulty filter added by the REST addon.

Thanks for the report!
We’ll try to fix it in the next patch: issue.

1 Like

Hello Klaus!

Vaadin does not correctly handle uploading when implementation of MultipartResolver differs from standard (see When CommonsMultipartResolver is registered, streamingFinished is never called. · Issue #11014 · vaadin/flow · GitHub)

The issue in Jmix will be fixed in 2.0 version and for now you can try to work around this problem.The easiest way is to enabling bean overriding:

spring.main.allow-bean-definition-overriding=true

And add the following code to the Application class:

@Autowired
private MultipartProperties multipartProperties;

@Bean
@Primary
MultipartResolver multipartResolver() {
    return new StandardServletMultipartResolver();
}

@Bean
public MultipartConfigElement multipartConfigElement() {
    return this.multipartProperties.createMultipartConfig();
}

(Upd.)
Seems it is enough to add MultipartConfigElement without overriding beans.

Another way is disabling RestAutoConfiguration and creating your custom Rest configuration without CommonsMultipartResolver bean.

For 1.5.0 version after WR you can face the following exception: #1535. It will be fixed in 1.5.1 version.

1 Like