-
-
Notifications
You must be signed in to change notification settings - Fork 97
Description
I can't figure out how to create a redirect rule for files that include spaces. For instance I have a file on my old site at /old-folder/file with spaces.jpg and when I import that file into Craft Assets the file ends up as /new-folder/file-with-spaces.jpg. This means I need to do both the folder redirect and a string manipulation. I am easily able to manage the folder redirect but I can't figure out the string manipulation.
I was able to to work out a that the rule to handle the match is:
old-folder/([^\s%20]*(?:[\s%20][^\s%20]*)*)\.([a-zA-Z]{3,4})$
But I can't find a replacement rule that will work. This option unfortunately adds + signs where the spaces were:
new-folder/$1.$2
To the best of my understanding this rule should work, but part of it is being treated as a literal instead of evaluated as part of the regular expression.
new-folder/${1//[%20]/-}.$2
An example of what I get when I use that rule:
new-folder/$%7B1//%5Cs/-%7D.pdf
I can't tell if this is a bug, a configuration error, or maybe I just haven't been able to find the correct regular expressions to make this work.