tomdesair / tus-java-server

Library to receive tus v1.0.0 file uploads in a Java server environment
MIT License
131 stars 62 forks source link

PostOnInvalidRequestURIException occurred in spring boot #21

Closed softboy99 closed 5 years ago

softboy99 commented 5 years ago

i checked the source code, the uploadUriPattern in PostURIValidator doesn't consider context-path of spring

ksvraja commented 5 years ago

Hi, I faced the similar issue, you can handle this with the regular expression like this /.*/upload/[a-z_A-Z]*/[0-9]+/?

The /.* shall mask the context-path of the spring. The /? is required for UUID (fileid) extraction.

tomdesair commented 5 years ago

Hi @softboy99,

You should try to pass in the Spring context path when configuring the TusFileUploadService. Here you can find an example of this: https://github.com/tomdesair/tus-java-server-spring-demo/blob/master/spring-boot-rest/src/main/java/me/desair/spring/tus/App.java#L43

Alternatively, you can also try to write an upload URI regex that matches your situation, for example .withUploadURI("/.*/api/upload").

Does this solve your problem?

tomdesair commented 5 years ago

I'm closing this issue as I assume that the above answers solved your problem.

ShanePark commented 1 year ago

Many Thanks ! It solved the problem.