Skip to content

Commit

Permalink
feat(core): deprecate creating temp files without extension
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu authored and tchiotludo committed Sep 25, 2023
1 parent e5ea2d0 commit 11270f7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions core/src/main/java/io/kestra/core/runners/RunContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -745,20 +745,28 @@ public synchronized Path tempDir(boolean create) {
return this.temporaryDirectory;
}

/**
* @deprecated use {@link #tempFile(String)} instead
*/
@Deprecated
public Path tempFile() throws IOException {
return this.tempFile(null, null);
}

public Path tempFile(String suffix) throws IOException {
return this.tempFile(null, suffix);
public Path tempFile(String extension) throws IOException {
return this.tempFile(null, extension);
}

/**
* @deprecated use {@link #tempFile(byte[], String)} instead
*/
@Deprecated
public Path tempFile(byte[] content) throws IOException {
return this.tempFile(content, null);
}

public Path tempFile(byte[] content, String suffix) throws IOException {
Path tempFile = Files.createTempFile(this.tempDir(), null, suffix);
public Path tempFile(byte[] content, String extension) throws IOException {
Path tempFile = Files.createTempFile(this.tempDir(), null, extension);

if (content != null) {
Files.write(tempFile, content);
Expand Down

0 comments on commit 11270f7

Please sign in to comment.