mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-10 15:35:59 +01:00
Fix file uploading issue
This commit is contained in:
@@ -116,6 +116,7 @@ class FileUploadController extends ScalatraServlet with FileUploadSupport with R
|
|||||||
case Some(file) if(mimeTypeChcker(file.name)) =>
|
case Some(file) if(mimeTypeChcker(file.name)) =>
|
||||||
defining(FileUtil.generateFileId){ fileId =>
|
defining(FileUtil.generateFileId){ fileId =>
|
||||||
f(file, fileId)
|
f(file, fileId)
|
||||||
|
contentType = "text/plain"
|
||||||
Ok(fileId)
|
Ok(fileId)
|
||||||
}
|
}
|
||||||
case _ => BadRequest()
|
case _ => BadRequest()
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ class CompositeScalatraFilter extends Filter {
|
|||||||
requestPath + "/"
|
requestPath + "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!checkPath.startsWith("/upload/") && !checkPath.startsWith("/git/") && !checkPath.startsWith("/git-lfs/") &&
|
||||||
|
!checkPath.startsWith("/plugin-assets/") && !checkPath.startsWith("/console/")){
|
||||||
filters
|
filters
|
||||||
.filter { case (_, path) =>
|
.filter { case (_, path) =>
|
||||||
val start = path.replaceFirst("/\\*$", "/")
|
val start = path.replaceFirst("/\\*$", "/")
|
||||||
@@ -48,6 +50,8 @@ class CompositeScalatraFilter extends Filter {
|
|||||||
return ()
|
return ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
chain.doFilter(request, response)
|
chain.doFilter(request, response)
|
||||||
}
|
}
|
||||||
@@ -62,8 +66,8 @@ class MockFilterChain extends FilterChain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilterChainFilter(chain: FilterChain) extends Filter {
|
//class FilterChainFilter(chain: FilterChain) extends Filter {
|
||||||
override def init(filterConfig: FilterConfig): Unit = ()
|
// override def init(filterConfig: FilterConfig): Unit = ()
|
||||||
override def destroy(): Unit = ()
|
// override def destroy(): Unit = ()
|
||||||
override def doFilter(request: ServletRequest, response: ServletResponse, mockChain: FilterChain) = chain.doFilter(request, response)
|
// override def doFilter(request: ServletRequest, response: ServletResponse, mockChain: FilterChain) = chain.doFilter(request, response)
|
||||||
}
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user