Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #5451 - Private Work Dir #5457

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.ByteArrayOutputStream2;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.MultiException;
import org.eclipse.jetty.util.MultiMap;
Expand Down Expand Up @@ -152,8 +151,8 @@ protected void write(byte[] bytes, int offset, int length) throws IOException

protected void createFile() throws IOException
{
Path parent = MultiPartFormInputStream.this._tmpDir.toPath();
Path tempFile = Files.createTempFile(parent, "MultiPart", "", IO.getUserOnlyFileAttribute(parent));
// Create temp file in Context tempDir (which is user private already)
Path tempFile = Files.createTempFile(MultiPartFormInputStream.this._tmpDir.toPath(), "MultiPart", "");
_file = tempFile.toFile();

OutputStream fos = Files.newOutputStream(tempFile, StandardOpenOption.WRITE);
Expand Down
2 changes: 1 addition & 1 deletion jetty-util/src/main/java/org/eclipse/jetty/util/IO.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public static void close(Writer writer)
* For Windows / Dos, that means {@link java.nio.file.attribute.DosFileAttributes}
* </p>
*/
public static FileAttribute<?>[] getUserOnlyFileAttribute(Path path)
public static FileAttribute<?>[] getUserPrivateFileAttribute(Path path)
joakime marked this conversation as resolved.
Show resolved Hide resolved
{
FileStore fileStore = null;
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ protected void write(byte[] bytes, int offset, int length)
protected void createFile()
throws IOException
{
Path parent = MultiPartInputStreamParser.this._tmpDir.toPath();
Path tempFile = Files.createTempFile(parent, "MultiPart", "", IO.getUserOnlyFileAttribute(parent));
// Create temp file in Context tempDir (which is user private already)
Path tempFile = Files.createTempFile(MultiPartInputStreamParser.this._tmpDir.toPath(), "MultiPart", "");
_file = tempFile.toFile();

OutputStream fos = Files.newOutputStream(tempFile, StandardOpenOption.WRITE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ public void makeTempDirectory(File parent, WebAppContext context)
else
{
//ensure file will always be unique by appending random digits
tmpDir = Files.createTempDirectory(parent.toPath(), temp).toFile();
tmpDir = Files.createTempDirectory(parent.toPath(), temp, IO.getUserPrivateFileAttribute(parent.toPath())).toFile();
}
configureTempDirectory(tmpDir, context);

Expand Down