With a recent Piwigo version 2.10.0 or 2.10.1 the plugin refuses to work, saying "Failed to login into remote piwigo. Upload to Piwigo version < 2.4 is no longer supported." The cause is in ./core/dplugins/generic/webservices/piwigo/piwigotalker.cpp line 487 in PiwigoTalker::parseResponseGetVersion() where the regex QRegExp verrx(QLatin1String(".?(\\d)\\.(\\d).*")); extracts only two digits (here '2' and '1' of "2.10.1") that then later in line 509 are calculated as d->version = qsl[1].toInt() * 10 + qsl[2].toInt(); resulting in 20+1 thus the value 21 which is less than 24. A correct attempt would be to allow at least 2 (better more) digits for each major.minor, hence QRegExp verrx(QLatin1String(".?(\\d+)\\.(\\d+).*")); and for example d->version = qsl[1].toInt() * 1000 + qsl[2].toInt(); that would work with up to 3 digits per minor. The error occurred also in digikam 5.9.0 Piwigo export kipi plugin.
Git commit 402a88c480daf819275470518e1a26c22c9efcd4 by Gilles Caulier. Committed on 14/10/2019 at 17:55. Pushed by cgilles into branch 'master'. fix wrong piwigo version parsed by talker FIXED-IN: 6.4.0 M +1 -1 core/dplugins/generic/webservices/piwigo/piwigotalker.cpp https://invent.kde.org/kde/digikam/commit/402a88c480daf819275470518e1a26c22c9efcd4
Thanks for the fast fix! While that likely will work, d->version will not match the proper version though, as it will be calculated as 20+10=30 (which is >24 so that part should be ok), mimicking a 3.0. Just mentioning in case d->version is used for other purposes as well, I didn't check; or in future needs to compare against a future version where "3.0" 30 would be less than "2.15" 35 ...
Thank you Gilles, I agree that a change like below could be better (up to 2.100.0 ;-) : diff --git a/core/dplugins/generic/webservices/piwigo/piwigotalker.cpp b/core/dplugins/generic/webservices/piwigo/piwigotalker.cpp index 8b75674ddd..eeb915bac0 100644 --- a/core/dplugins/generic/webservices/piwigo/piwigotalker.cpp +++ b/core/dplugins/generic/webservices/piwigo/piwigotalker.cpp @@ -506,7 +506,7 @@ void PiwigoTalker::parseResponseGetVersion(const QByteArray& data) if (verrx.exactMatch(v)) { QStringList qsl = verrx.capturedTexts(); - d->version = qsl[1].toInt() * 10 + qsl[2].toInt(); + d->version = qsl[1].toInt() * 100 + qsl[2].toInt(); qCDebug(DIGIKAM_WEBSERVICES_LOG) << "Version: " << d->version; break; } diff --git a/core/dplugins/generic/webservices/piwigo/piwigotalker.h b/core/dplugins/generic/webservices/piwigo/piwigotalker.h index 739cf2096e..14e751a920 100644 --- a/core/dplugins/generic/webservices/piwigo/piwigotalker.h +++ b/core/dplugins/generic/webservices/piwigo/piwigotalker.h @@ -73,7 +73,7 @@ public: enum { CHUNK_MAX_SIZE = 512*1024, - PIWIGO_VER_2_4 = 24 + PIWIGO_VER_2_4 = 204 }; public:
Hi Frédéric, Whole digiKam source code is now migrated to gitlab, and normally your account as developer must be created. You can commit your fix in the the plugin directly. If your account is not present, we will ask to KDE core team to recreate the account. Best Gilles Caulier
Git commit b08f3555d511a5a8117566dbe9d655af0019ae2c by Gilles Caulier. Committed on 18/10/2019 at 14:37. Pushed by cgilles into branch 'master'. apply patch from Frederic Coiffier about Piwigo version check in digiKam plugin M +1 -1 core/dplugins/generic/webservices/piwigo/piwigoplugin.cpp M +2 -2 core/dplugins/generic/webservices/piwigo/piwigotalker.cpp M +2 -2 core/dplugins/generic/webservices/piwigo/piwigotalker.h https://invent.kde.org/kde/digikam/commit/b08f3555d511a5a8117566dbe9d655af0019ae2c
Ah nice, that looks promising :-) Could both commits be backported to 5.9.0 kipi plugins so that Debian buster and derivates would benefit, and maybe 6.1.0 for Fedora F29 and 6.2.0/6.3.0 for others? Thanks. Eike
(In reply to Eike Rathke from comment #6) > Could both commits be backported to 5.9.0 kipi plugins so that Debian buster +1!