Fix handling of attachments in JSON RPC

It turns out that using a custom serializer on an
input stream did not work well. For one the stream seems
to be getting closed before the JSON gets written. But
also the method for writing it was throwing an
UnsupportedOperationException further down in Jackson.

The above simplifies the matter by simply outputting the
Base64 string first and then setting it on the model.
This commit is contained in:
cedb 2022-11-23 23:34:54 -05:00
parent b6e9dfa97d
commit 54a55f4ea9

View file

@ -1,18 +0,0 @@
package org.asamk.signal.json;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.io.InputStream;
public class JsonStreamSerializer extends JsonSerializer<InputStream> {
@Override
public void serialize(
final InputStream value, final JsonGenerator jsonGenerator, final SerializerProvider serializers
) throws IOException {
jsonGenerator.writeBinary(value, -1);
}
}