提交 ec919347 编写于 作者: R Rossen Stoyanchev

Use correct file options for transferTo

Similar to fix applied to Synchronoss implementation in #cef98e.
上级 1259b7cb
......@@ -21,6 +21,7 @@ import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.Channel;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Collections;
......@@ -367,6 +368,10 @@ public class DefaultMultipartMessageReader extends LoggingCodecSupport implement
private static class DefaultFilePart extends DefaultPart implements FilePart {
private static final OpenOption[] FILE_CHANNEL_OPTIONS =
{StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE};
public DefaultFilePart(HttpHeaders headers, DataBuffer body) {
super(headers, body);
}
......@@ -380,7 +385,7 @@ public class DefaultMultipartMessageReader extends LoggingCodecSupport implement
@Override
public Mono<Void> transferTo(Path dest) {
return Mono.using(() -> AsynchronousFileChannel.open(dest, StandardOpenOption.WRITE),
return Mono.using(() -> AsynchronousFileChannel.open(dest, FILE_CHANNEL_OPTIONS),
this::writeBody, this::close);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册