Skip to content
Permalink
Browse files

[feature][expression] fix base64 expression according to suggestions by

  • Loading branch information
JanCaha authored and nyalldawson committed May 10, 2020
1 parent 0b26024 commit 8b55e996f92559f3fe2b69d4b905b123da5926af
Showing with 3 additions and 8 deletions.
  1. +3 −8 src/core/expression/qgsexpressionfunction.cpp
@@ -5626,21 +5626,16 @@ static QVariant fcnHashSha256( const QVariantList &values, const QgsExpressionCo

static QVariant fcnToBase64( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
{
QString value = QgsExpressionUtils::getStringValue( values.at( 0 ), parent );

const QByteArray input = value.toLocal8Bit();

const QByteArray input = values.at( 0 ).toByteArray();
return QVariant( QString( input.toBase64() ) );
}

static QVariant fcnFromBase64( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
{
QString value = QgsExpressionUtils::getStringValue( values.at( 0 ), parent );

const QString value = QgsExpressionUtils::getStringValue( values.at( 0 ), parent );
const QByteArray base64 = value.toLocal8Bit();
const QByteArray decoded = QByteArray::fromBase64( base64 );

return QVariant( QString( decoded ) );
return QVariant( decoded );
}

const QList<QgsExpressionFunction *> &QgsExpression::Functions()

0 comments on commit 8b55e99

Please sign in to comment.
You can’t perform that action at this time.