summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-05-25 14:57:47 +0100
committerCarl Hetherington <cth@carlh.net>2015-05-25 14:57:47 +0100
commitb4696a8776f69d6ed7bea01653d1cb6e62b6a8e9 (patch)
tree3c00dbe78768aea0261a1cbf048b0082a1e78d19 /src
parent1004209bb71feb33688e9dffed89313e103db4c0 (diff)
48393469730c8fb8759cc41d50c95c26380991be from master; block possibly bad characters from DCP names.
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 0af4c5611..e5c5d9312 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -656,11 +656,26 @@ Film::isdcf_name (bool if_created_now) const
string
Film::dcp_name (bool if_created_now) const
{
+ string unfiltered;
if (use_isdcf_name()) {
- return isdcf_name (if_created_now);
+ unfiltered = isdcf_name (if_created_now);
+ } else {
+ unfiltered = name ();
}
- return name();
+ /* Filter out `bad' characters which cause problems with some systems.
+ There's no apparent list of what really is allowed, so this is a guess.
+ */
+
+ string filtered;
+ string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
+ for (size_t i = 0; i < unfiltered.size(); ++i) {
+ if (allowed.find (unfiltered[i]) != string::npos) {
+ filtered += unfiltered[i];
+ }
+ }
+
+ return filtered;
}
void