Trim spaces from entries to certificate download pages.
authorCarl Hetherington <cth@carlh.net>
Fri, 13 Jan 2023 22:06:38 +0000 (23:06 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 13 Jan 2023 22:06:38 +0000 (23:06 +0100)
src/wx/barco_alchemy_certificate_panel.cc
src/wx/dolby_doremi_certificate_panel.cc
src/wx/gdc_certificate_panel.cc
src/wx/qube_certificate_panel.cc

index 981efee1f18990f5a6708794a99cdc3ba14b555c..19bd18a8dc02c731118c0ae73eba682fb45e43af 100644 (file)
 
 */
 
+
 #include "barco_alchemy_certificate_panel.h"
 #include "download_certificate_dialog.h"
 #include "wx_util.h"
 #include "lib/internet.h"
 #include "lib/compose.hpp"
 #include "lib/config.h"
+#include <boost/algorithm/string.hpp>
+
 
 using std::string;
+using namespace boost::algorithm;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 
+
 BarcoAlchemyCertificatePanel::BarcoAlchemyCertificatePanel (DownloadCertificateDialog* dialog)
        : CredentialsDownloadCertificatePanel (
                        dialog,
@@ -54,8 +59,9 @@ BarcoAlchemyCertificatePanel::ready_to_download () const
 void
 BarcoAlchemyCertificatePanel::do_download ()
 {
-       string const serial = wx_to_std (_serial->GetValue());
-       string const url = String::compose (
+       string serial = wx_to_std (_serial->GetValue());
+       trim(serial);
+       string url = String::compose (
                "ftp://%1:%2@certificates.barco.com/%3xxx/%4/Barco-ICMP.%5_cert.pem",
                Config::instance()->barco_username().get(),
                Config::instance()->barco_password().get(),
@@ -63,6 +69,7 @@ BarcoAlchemyCertificatePanel::do_download ()
                serial,
                serial
                );
+       trim(url);
 
        auto error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load_certificate, this, _1, _2));
        if (error) {
index 5a578a7eccedad9fcae64e9ab867008895b7302d..7cab6b24b6a87dcfe37dcd920e50a722dd1670aa 100644 (file)
 #include <dcp/raw_convert.h>
 #include <curl/curl.h>
 #include <zip.h>
+#include <boost/algorithm/string.hpp>
 
 
 using std::function;
 using std::list;
 using std::string;
+using namespace boost::algorithm;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
@@ -160,7 +162,8 @@ try_ims3000 (list<string>& urls, list<string>& files, string prefix, string seri
 void
 DolbyDoremiCertificatePanel::do_download ()
 {
-       string const serial = wx_to_std (_serial->GetValue());
+       string serial = wx_to_std(_serial->GetValue());
+       trim(serial);
 
        /* Try dcp2000, imb and ims prefixes (see mantis #375) */
 
index e670f01eb4815f543a07cf96ac061e88ef89f031..d78b1b56dfd2397bda51331cda5c7e0c0e43c938 100644 (file)
 
 */
 
-#include "gdc_certificate_panel.h"
+
 #include "download_certificate_dialog.h"
+#include "gdc_certificate_panel.h"
 #include "wx_util.h"
-#include "lib/internet.h"
 #include "lib/compose.hpp"
 #include "lib/config.h"
+#include "lib/internet.h"
+#include <boost/algorithm/string.hpp>
+
 
 using std::string;
-using boost::optional;
+using namespace boost::algorithm;
 using boost::bind;
+using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 
+
 GDCCertificatePanel::GDCCertificatePanel (DownloadCertificateDialog* dialog)
        : CredentialsDownloadCertificatePanel (
                        dialog,
@@ -50,16 +55,18 @@ void
 GDCCertificatePanel::do_download ()
 {
        string serial = wx_to_std (_serial->GetValue());
+       trim(serial);
        if (!serial.empty() && serial[0] == 'A') {
                /* We're adding the A ourselves */
                serial = serial.substr(1);
        }
-       string const url = String::compose(
+       string url = String::compose(
                "ftp://%1:%2@ftp.gdc-tech.com/SHA256/A%3.crt.pem",
                Config::instance()->gdc_username().get(),
                Config::instance()->gdc_password().get(),
                serial
                );
+       trim(url);
 
        auto error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1, _2));
 
index 8e9662e7d3ae24508400df4b0173e7a4ad205eec..b40a9ecf64e1d2c6b86a93026cc96683600fcd82 100644 (file)
 */
 
 
-#include "qube_certificate_panel.h"
 #include "download_certificate_dialog.h"
+#include "qube_certificate_panel.h"
 #include "wx_util.h"
-#include "lib/internet.h"
 #include "lib/compose.hpp"
 #include "lib/config.h"
-#include <boost/algorithm/string/predicate.hpp>
+#include "lib/internet.h"
+#include <boost/algorithm/string.hpp>
 
 
 using std::string;
 using std::list;
+using namespace boost::algorithm;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
@@ -56,7 +57,9 @@ QubeCertificatePanel::do_download ()
                return;
        }
 
-       auto const serial = wx_to_std(_serial->GetValue());
+       auto serial = wx_to_std(_serial->GetValue());
+       trim(serial);
+
        optional<string> name;
        for (auto i: files) {
                if (boost::algorithm::starts_with(i, String::compose("%1-%2-", _type, serial))) {