Users are getting an error registering publishes in our config when the filename contains an ampersand character (&). I have verified that removing the & from the filename in Windows prevents the error:
Traceback (most recent call last):
File "C:\Users\Artist\AppData\Roaming\Shotgun\bundle_cache\app_store\tk-multi-publish2\v2.6.1\python\tk_multi_publish2\dialog.py", line 1229, in do_publish
task_generator=self._publish_task_generator()
File "C:\Users\Artist\AppData\Roaming\Shotgun\bundle_cache\app_store\tk-multi-publish2\v2.6.1\python\tk_multi_publish2\api\manager.py", line 346, in publish
self._post_phase_hook.post_publish(self.tree)
File "C:\Users\Artist\AppData\Roaming\Shotgun\bundle_cache\sg\dev\v82159\hooks\tk-multi-publish2\post_phase.py", line 253, in post_publish
item = self._update_publish_data(p4, item, changed_files, submitted_change)
File "C:\Users\Artist\AppData\Roaming\Shotgun\bundle_cache\sg\dev\v82159\hooks\tk-multi-publish2\post_phase.py", line 287, in _update_publish_data
item.properties.sg_publish_data = sgtk.util.register_publish(**item.properties.publish_data)
File "C:\Users\Artist\AppData\Roaming\Shotgun\dev\p188c595.basic.desktop\cfg\install\core\python\tank\log.py", line 514, in wrapper
response = func(*args, **kwargs)
File "C:\Users\Artist\AppData\Roaming\Shotgun\dev\p188c595.basic.desktop\cfg\install\core\python\tank\util\shotgun\publish_creation.py", line 353, in register_publish
raise ShotgunPublishError(error_message="%s" % e, entity=entity)
tank.util.errors.ShotgunPublishError: Unable to complete publishing because of the following error: API create() invalid/missing relative_path hash string 'relative_path':
{"relative_path"=>
"Consumables/Audio/Food & Drink, Ingredients, Ketchup, Chocolate Sauce, Bottle, Squeeze, Squirt 04 SND21112.wav",
"local_storage"=>
{"type"=>"LocalStorage",
"id"=>102,
"code"=>"deva",
"windows_path"=>"B:\\",
"linux_path"=>nil,
"mac_path"=>"/B"}}.
Any suggestions on the best way to fix this problem? I’m not sure what other characters might cause this error that are otherwise legal characters in the file system.
Sure. Do you have a list of illegal characters that will crash this function, then, so I may adequately protect against them in our validation step so as not to anger the ShotGrid Toolkit API with its exception that makes no sense?
These particular files come from purchased libraries with naming conventions not created internally… renaming them changes their “original” name from the library files.
3.282 Portable Filename Character Set
The set of characters from which portable filenames are constructed.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 . _ -
This I don’t think is so much a limitation of the toolkit api but more that allowing those kind of characters is going to lead to a lot more errors down the line as an ampersand for example might need to be escaped to work with a particular function, especially if the datatype is converted (i.e. to ascii or utf-8 etc).
Ok, thanks for this! I’m still not happy this function is crashing in such a strange way, but I’ll implement custom validation for Desktop Publisher filenames going forward to work around it.
Sure but the rest of the world doesn’t work that way and neither does ShotGrid enforce it elsewhere. So yes it is a bad idea for technical reasons but if it’s going to cause fatal exceptions in ShotGrid it should be enforced globally in the website and toolkit… or it should be handled properly.
On a side topic, related to Editorial workflows and audio logging…
This is a good candidate for a custom UI plugin for mp2 that exposes a tags field so that additional, queryable, information can be supplied with the published file. Descriptions are better than long filenames, but even better are tags!
We haven’t got audio logging setup let alone a tagging ui plugin, but I could see this being useful for whoever is cataloguing this stuff.