diff options
Diffstat (limited to 'src/qt/walletframe.cpp')
-rw-r--r-- | src/qt/walletframe.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 6b38e207d3..adc7793916 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -212,7 +212,15 @@ void WalletFrame::gotoLoadPSBT(bool from_clipboard) return; } std::ifstream in{filename.toLocal8Bit().data(), std::ios::binary}; - data.assign(std::istream_iterator<unsigned char>{in}, {}); + data.assign(std::istreambuf_iterator<char>{in}, {}); + + // Some psbt files may be base64 strings in the file rather than binary data + std::string b64_str{data.begin(), data.end()}; + b64_str.erase(b64_str.find_last_not_of(" \t\n\r\f\v") + 1); // Trim trailing whitespace + auto b64_dec = DecodeBase64(b64_str); + if (b64_dec.has_value()) { + data = b64_dec.value(); + } } std::string error; |