mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
fix invalid claimed length error on transaction file load
This commit is contained in:
parent
cfaa1f6c6e
commit
f37ff47850
2 changed files with 4 additions and 13 deletions
2
drongo
2
drongo
|
|
@ -1 +1 @@
|
|||
Subproject commit ca758e128876470f673b5955d75d5311b47c6938
|
||||
Subproject commit ad60a37d0ea5ae68d8c9caa0ff10d2cb63203b0d
|
||||
|
|
@ -633,19 +633,10 @@ public class AppController implements Initializable {
|
|||
byte[] bytes = Files.readAllBytes(file.toPath());
|
||||
String name = file.getName();
|
||||
|
||||
try {
|
||||
if(Utils.isHex(bytes) || Utils.isBase64(bytes)) {
|
||||
addTransactionTab(name, file, new String(bytes, StandardCharsets.UTF_8).trim());
|
||||
} else {
|
||||
addTransactionTab(name, file, bytes);
|
||||
} catch(ParseException e) {
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
|
||||
ByteSource byteSource = new ByteSource() {
|
||||
@Override
|
||||
public InputStream openStream() {
|
||||
return inputStream;
|
||||
}
|
||||
};
|
||||
|
||||
String text = byteSource.asCharSource(Charsets.UTF_8).read().trim();
|
||||
addTransactionTab(name, file, text);
|
||||
}
|
||||
} catch(IOException e) {
|
||||
showErrorDialog("Error opening file", e.getMessage());
|
||||
|
|
|
|||
Loading…
Reference in a new issue