Be more careful about allowing possibly-trouble-causing characters in DCP filenames.
[dcpomatic.git] / src / lib / cinema_kdms.cc
index c05dd613857db93776e1d6a288e9d7d2fd343e8c..e82a987e846f49dc1ea0bd772fecadc8e80f4456 100644 (file)
@@ -64,7 +64,7 @@ CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, dcp::NameFormat nam
                }
 
                name_values['s'] = i.screen->name;
-               string const name = name_format.get(name_values) + ".xml";
+               string const name = name_format.get(name_values, ".xml");
                if (zip_add (zip, name.c_str(), source) == -1) {
                        throw runtime_error ("failed to add KDM to ZIP archive");
                }
@@ -128,7 +128,7 @@ CinemaKDMs::write_zip_files (
        BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
                boost::filesystem::path path = directory;
                name_values['c'] = i.cinema->name;
-               path /= name_format.get(name_values) + ".zip";
+               path /= name_format.get(name_values, ".zip");
                i.make_zip_file (path, name_format, name_values);
        }
 }
@@ -164,14 +164,14 @@ CinemaKDMs::email (
 
                string subject = config->kdm_subject();
                boost::algorithm::replace_all (subject, "$CPL_NAME", cpl_name);
-               boost::algorithm::replace_all (subject, "$START_TIME", name_values['f']);
-               boost::algorithm::replace_all (subject, "$END_TIME", name_values['t']);
+               boost::algorithm::replace_all (subject, "$START_TIME", name_values['b']);
+               boost::algorithm::replace_all (subject, "$END_TIME", name_values['e']);
                boost::algorithm::replace_all (subject, "$CINEMA_NAME", i.cinema->name);
 
                string body = config->kdm_email().c_str();
                boost::algorithm::replace_all (body, "$CPL_NAME", cpl_name);
-               boost::algorithm::replace_all (body, "$START_TIME", name_values['f']);
-               boost::algorithm::replace_all (body, "$END_TIME", name_values['t']);
+               boost::algorithm::replace_all (body, "$START_TIME", name_values['b']);
+               boost::algorithm::replace_all (body, "$END_TIME", name_values['e']);
                boost::algorithm::replace_all (body, "$CINEMA_NAME", i.cinema->name);
 
                string screens;
@@ -189,7 +189,7 @@ CinemaKDMs::email (
                        email.add_bcc (config->kdm_bcc ());
                }
 
-               email.add_attachment (zip_file, name_format.get(name_values) + ".zip", "application/zip");
+               email.add_attachment (zip_file, name_format.get(name_values, ".zip"), "application/zip");
 
                Config* c = Config::instance ();