I've been attempting to use: $tools.base64.encode(query); This saves files that appear to use base 64 for the files names but when I attempt to decode them I get output like: olv fw 8vrrku Spoiler: result [% # Assign values based on regex matches image_group_value = p1.image.0.group == '' ? 0 : 1; image_result_value = p1.image1.0.result == '' ? 0 : 1; local_nav_value = p1.local.0.nav == '' ? 0 : 1; hotel_nav_value = p1.hotel.0.nav == '' ? 0 : 1; # Use Math module for directory calculation USE Math; # Encode the query to base64 encoded_query = $tools.base64.encode(query); # Determine the output based on conditions IF image_group_value == 1 and local_nav_value == 0 and hotel_nav_value == 0 and image_result_value == 0; "empty_images/" _ encoded_query _ ".html"; ELSE; "serp_raw/us-" _ Math.int(query.num / 900) _ "/" _ encoded_query; END; %]
The case of characters in file names is not preserved, so you cannot decode the values correctly. For example, this template Code: [% tools.base64.encode('test') _ '.txt' %] will return the following string Code: dGVzdA==.txt But in the file name it might look like this: Code: dgvzda==.txt