From bb9fb41c157d59ea2a6206dacb99cccc4bd5de11 Mon Sep 17 00:00:00 2001 From: tanhe123 Date: Thu, 30 Nov 2017 18:03:32 +0800 Subject: [PATCH 1/2] add path extension support to resolve svg bug --- src/main/java/net/coding/ide/config/WebConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/coding/ide/config/WebConfig.java b/src/main/java/net/coding/ide/config/WebConfig.java index 01961a9..65c5ac4 100644 --- a/src/main/java/net/coding/ide/config/WebConfig.java +++ b/src/main/java/net/coding/ide/config/WebConfig.java @@ -80,7 +80,7 @@ public void addCorsMappings(CorsRegistry registry) { @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { - configurer.favorPathExtension(false); + configurer.favorPathExtension(true); } @Override From 4bf53d9fcc69f073a61bbbe55ed7a80a267a934c Mon Sep 17 00:00:00 2001 From: tanhe123 Date: Thu, 30 Nov 2017 18:19:54 +0800 Subject: [PATCH 2/2] fix upload file limit --- .../net/coding/ide/web/controller/ExceptionAdvice.java | 6 +++--- src/main/resources/application.properties | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/coding/ide/web/controller/ExceptionAdvice.java b/src/main/java/net/coding/ide/web/controller/ExceptionAdvice.java index 91bd855..86d38c1 100644 --- a/src/main/java/net/coding/ide/web/controller/ExceptionAdvice.java +++ b/src/main/java/net/coding/ide/web/controller/ExceptionAdvice.java @@ -35,8 +35,8 @@ @ControllerAdvice public class ExceptionAdvice { - @Value("${UPLOAD_FILE_SIZE_LIMIT}") - private int fileSizeLimit; + @Value("${spring.http.multipart.max-file-size}") + private String fileSizeLimit; @ExceptionHandler(WorkspaceIOException.class) @ResponseStatus(INTERNAL_SERVER_ERROR) @@ -98,7 +98,7 @@ public ResponseEntity workspaceException(WorkspaceException e) { @ResponseStatus(PAYLOAD_TOO_LARGE) @ResponseBody public JsonObject maxUploadSizeExceededException(MaxUploadSizeExceededException e) { - return makeMsg(format("Upload file size is limit to %d Mb.", fileSizeLimit)); + return makeMsg(format("Upload file size is limit to %s.", fileSizeLimit)); } @ExceptionHandler(GitCloneAuthFailException.class) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 1858134..c5c27f5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -17,9 +17,6 @@ CODING_IDE_HOME=#{systemProperties['user.home']}/.coding-ide SPACE_HOME=${CODING_IDE_HOME}/workspace PACKAGE_HOME=${CODING_IDE_HOME}/packages -# Max file size to upload (in Mb) -UPLOAD_FILE_SIZE_LIMIT=10 - # PTY_LIB_FOLDER PTY_LIB_FOLDER=src/main/resources/lib @@ -39,4 +36,7 @@ spring.jpa.show-sql=false # spring static resources -spring.resources.static-locations=classpath:/resources/,classpath:/META-INF/resources/,classpath:/META-INF/resources/webjars/ \ No newline at end of file +spring.resources.static-locations=classpath:/resources/,classpath:/META-INF/resources/,classpath:/META-INF/resources/webjars/ + +spring.http.multipart.max-file-size=1024MB +spring.http.multipart.max-request-size=1024MB \ No newline at end of file