summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-09-07 23:24:06 +0200
committerCarl Hetherington <cth@carlh.net>2023-09-07 23:24:08 +0200
commit77df016da7f8e1ee3f31c2a0d147c939e78add97 (patch)
tree3fee8b0c893858dc86afdbe7cf1163c97d325057 /test
parent5a1966c187c189da43a650f1425b29190f5cfe78 (diff)
Sanitise asset names after potentially failed %-based substitutions (#945).
If there's a %x in the format string, where %x is not recognised, we should at least remove the %.
Diffstat (limited to 'test')
-rw-r--r--test/file_naming_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/file_naming_test.cc b/test/file_naming_test.cc
index 1961bfcfe..1b5871bd2 100644
--- a/test/file_naming_test.cc
+++ b/test/file_naming_test.cc
@@ -197,3 +197,23 @@ BOOST_AUTO_TEST_CASE (subtitle_file_naming)
BOOST_CHECK_EQUAL(got, 1);
}
+
+BOOST_AUTO_TEST_CASE(remove_bad_characters_from_template)
+{
+ ConfigRestorer cr;
+
+ /* %z is not recognised, so the % should be discarded so it won't trip
+ * an invalid URI check in make_and_verify_dcp
+ */
+ Config::instance()->set_dcp_asset_filename_format(dcp::NameFormat("%c%z"));
+
+ auto content = content_factory("test/data/flat_red.png");
+ auto film = new_test_film2("remove_bad_characters_from_template", content);
+ make_and_verify_dcp(
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE,
+ dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
+ });
+}
+