fix bug: 支持0字节文件上传

This commit is contained in:
zhouxin5253@163.com 2021-01-17 08:54:36 +08:00
parent bb20fc8d41
commit 892dbc21f9
2 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@
</parent> </parent>
<groupId>com.github.zxbu</groupId> <groupId>com.github.zxbu</groupId>
<artifactId>webdav-teambition</artifactId> <artifactId>webdav-teambition</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2-SNAPSHOT</version>
<name>webdav-teambition</name> <name>webdav-teambition</name>
<description>Demo project for Spring Boot</description> <description>Demo project for Spring Boot</description>

View File

@ -88,8 +88,8 @@ public class TeambitionFileSystemStore implements IWebdavStore {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = requestAttributes.getRequest(); HttpServletRequest request = requestAttributes.getRequest();
int contentLength = request.getContentLength(); int contentLength = request.getContentLength();
if (contentLength <= 0) { if (contentLength < 0) {
return 0; contentLength = 0;
} }
teambitionClientService.uploadPre(resourceUri, contentLength, content); teambitionClientService.uploadPre(resourceUri, contentLength, content);
return contentLength; return contentLength;