From 747b0089697c5f16f66be87894b016573f08f54d Mon Sep 17 00:00:00 2001 From: msmol Date: Mon, 5 Jun 2017 11:39:24 -0400 Subject: [PATCH] Only match as totp if any part of the path or filename BEGINS with the otp identifier --- pass.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pass.cpp b/pass.cpp index f1d33a9..73c7bac 100644 --- a/pass.cpp +++ b/pass.cpp @@ -130,8 +130,9 @@ void Pass::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &m if (passOtpIdentifier != nullptr) { this->passOtpIdentifier = passOtpIdentifier; } + auto isOtp = match.text().split('/').filter(QRegularExpression("^" + QRegularExpression::escape(this->passOtpIdentifier) + ".*")).size() > 0; - auto ret = match.text().contains(this->passOtpIdentifier, Qt::CaseInsensitive) ? + auto ret = isOtp ? QProcess::execute(QString("pass otp -c ") + match.text()) : QProcess::execute(QString("pass -c ") + match.text()); if (ret == 0) {