Commit 844df264 authored by Maxym Borodenko's avatar Maxym Borodenko

FIX: metadata always null while uploading file

parent 4b2e8207
......@@ -51,7 +51,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.HandlerMapping;
......@@ -134,9 +134,9 @@ public class RepositoryController {
* @throws NotFoundElement the not found element
*/
@PostMapping(value = "/upload/**")
public RepositoryFile uploadFile(@RequestParam(name = "file", required = true) final MultipartFile file,
@RequestParam(name = "metadata", required = false) final RepositoryFile metadata, final HttpServletRequest request) throws InvalidRepositoryPathException,
InvalidRepositoryFileDataException, IOException {
public RepositoryFile uploadFile(@RequestPart(name = "file", required = true) final MultipartFile file,
@RequestPart(name = "metadata", required = false) final RepositoryFile metadata,
final HttpServletRequest request) throws InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
final String folderPath = ((String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)).substring((CONTROLLER_URL + "/upload").length());
Path repositoryPath = Paths.get(folderPath);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment