Skip to content

Commit

Permalink
fix(core): Serialize null as null and not "null" in the ION file
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu authored and tchiotludo committed Apr 24, 2023
1 parent 5b28dc1 commit 8c25130
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/io/kestra/core/serializers/FileSerde.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ abstract public class FileSerde {
private static final TypeReference<Object> TYPE_REFERENCE = new TypeReference<>(){};

public static void write(OutputStream output, Object row) throws IOException {
output.write(MAPPER.writeValueAsBytes(row));
output.write("\n".getBytes());
if (row != null) { // avoid writing "null"
output.write(MAPPER.writeValueAsBytes(row));
output.write("\n".getBytes());
}
}

public static FlowableOnSubscribe<Object> reader(BufferedReader input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.io.FileOutputStream;
import java.net.URI;
import java.util.List;
import java.util.Map;

import static io.kestra.core.utils.Rethrow.throwConsumer;

Expand Down
4 changes: 4 additions & 0 deletions ui/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ export default class Utils {
* @return Formatted string.
*/
static humanFileSize(bytes, si = false, dp = 1) {
if (bytes === undefined) {
// when the size is 0 it arrives as undefined here!
return "0B";
}
const thresh = si ? 1000 : 1024;

if (Math.abs(bytes) < thresh) {
Expand Down

0 comments on commit 8c25130

Please sign in to comment.