diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-05-25 14:57:47 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-05-25 14:57:47 +0100 |
| commit | b4696a8776f69d6ed7bea01653d1cb6e62b6a8e9 (patch) | |
| tree | 3c00dbe78768aea0261a1cbf048b0082a1e78d19 | |
| parent | 1004209bb71feb33688e9dffed89313e103db4c0 (diff) | |
48393469730c8fb8759cc41d50c95c26380991be from master; block possibly bad characters from DCP names.
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | TO_PORT | 3 | ||||
| -rw-r--r-- | src/lib/film.cc | 19 |
3 files changed, 22 insertions, 5 deletions
@@ -1,5 +1,10 @@ 2015-05-25 Carl Hetherington <cth@carlh.net> + * Block all but alphanumeric characters with a few bits + of punctuation from DCP names. + + * Improve view of jobs in various ways. + * Increase the number of images that DCP-o-matic will keep around in memory before resorting to pushing them to disk. @@ -1,6 +1,3 @@ -33a2bece96b7875134c99a2053a2fc59e828ae33 -b41b6528fbe0d270415a8500a612da19469e49e4 -c040b70eb777630ef0fdbb80cd419f6b3da4b46e ea2becf3a859bc38c783d15f165d71f2ccb8c1d6 21cb435ed5eb250a7f94887ddd75f6b367ea231f Multi-stream audio stuff. 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 |
