CollectionPaths in user wildcards for sub-folder renaming#544
Open
josephgarnier wants to merge 1 commit into
Open
CollectionPaths in user wildcards for sub-folder renaming#544josephgarnier wants to merge 1 commit into
josephgarnier wants to merge 1 commit into
Conversation
The field CollectionPaths can now be used in user wildcards for sub-folders renaming
|
Hey, just mentioning that I have the same issue. I'm trying to organize my files according to the user-specifief wildcard:
without success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently for a "rename and move" action, it is not possible to apply an operation on the CollectionPaths field in a user-defined wildcard.

For example, let's say I have this configuration:
and these wildcards:
{ "1": { "default": { "field": "title", "operations": [ { "function": "replace", "regex": "[\\:|\\,|\\.]", "replacement": "" }, { "function": "replace", "regex": "[\\']", "replacement": "_" } ] } }, "2": { "default": { "field": "collectionPaths", "operations": [ { "function": "replace", "regex": "[\\s]", "replacement": "_" } ] } } }Normally with the wildcard number 2, it is expected that the attached file that is in the collection
3_Resources/Economics Finance Business and Management/Business and Management/Management and Management Techniques/Knowledge Managementwill be renamed and then moved to the folder<root>/3_Resources/Economics_Finance_Business_and_Management/Business_and_Management/Management_and_Management_Techniques/Knowledge_Managementby replacing the spaces by_.Here, in pictures, the structure of the collections and the expected result:


However, since the
function wildcardTable(item)function inwildcards.jsexpects to work only with fields containing strings and not objects (as is the case with theCollectionPathsfield, which is an array), thereplace is not a functionerror occurred. This patch fixes that.