Updating path templates while maintaining backwards compatibility

Hey,

Is it possible to update a path template but also retain the old version for backwards compatibility?

For instance we have a publish path template:
publish_path: '@version_path/(name}-v{version}[.{SEQ}].{ext}'
But want to change the - before the version to an _
publish_path: '@version_path/(name}_v{version}[.{SEQ}].{ext}'

The change works as expected for any new publishes but obviously anything published before the change does not get picked up in apps such as tk-multi-workfiles2 which requires the publish path to be set.

Similarly, thoughts go to methods such as get_path_template or apply_path_fields which we would want to work with old paths but return new templates.

Alternatively is it possible for a single path template to have an OR condition so that we first try using _ but fallback to -
In my head this would work/look something like this:
publish_path: '@version_path/(name}[_|-]v{version}[.{SEQ}].{ext}'
So all new publishes would use the first option _
But when querying existing publishes we check both

To do this likely you need 2x templates defined with different names, but that might impact cases you have hardcoded template names.

The OR condition was my thought when reading this, but likely would lead to unexpected behaviour unless you test that the first _ item is respected when a decision has to be made by toolkit when calling apply_fields or similar.

Depending on the quantity of affected PublishedFiles you could do a hard swap and re-publish data using the new template, but this depends on dependencies to Versions, feedback and statuses etc that could complicate things.

1 Like