Fix file uploading issue

This commit is contained in:
Naoki Takezoe
2017-12-06 03:53:43 +09:00
parent 557ed827d0
commit 27ab21c9a7
2 changed files with 21 additions and 16 deletions

View File

@@ -116,6 +116,7 @@ class FileUploadController extends ScalatraServlet with FileUploadSupport with R
case Some(file) if(mimeTypeChcker(file.name)) =>
defining(FileUtil.generateFileId){ fileId =>
f(file, fileId)
contentType = "text/plain"
Ok(fileId)
}
case _ => BadRequest()

View File

@@ -36,6 +36,8 @@ class CompositeScalatraFilter extends Filter {
requestPath + "/"
}
if(!checkPath.startsWith("/upload/") && !checkPath.startsWith("/git/") && !checkPath.startsWith("/git-lfs/") &&
!checkPath.startsWith("/plugin-assets/") && !checkPath.startsWith("/console/")){
filters
.filter { case (_, path) =>
val start = path.replaceFirst("/\\*$", "/")
@@ -48,6 +50,8 @@ class CompositeScalatraFilter extends Filter {
return ()
}
}
}
chain.doFilter(request, response)
}
@@ -62,8 +66,8 @@ class MockFilterChain extends FilterChain {
}
}
class FilterChainFilter(chain: FilterChain) extends Filter {
override def init(filterConfig: FilterConfig): Unit = ()
override def destroy(): Unit = ()
override def doFilter(request: ServletRequest, response: ServletResponse, mockChain: FilterChain) = chain.doFilter(request, response)
}
//class FilterChainFilter(chain: FilterChain) extends Filter {
// override def init(filterConfig: FilterConfig): Unit = ()
// override def destroy(): Unit = ()
// override def doFilter(request: ServletRequest, response: ServletResponse, mockChain: FilterChain) = chain.doFilter(request, response)
//}