${unique_prefix} contains "/" in s3-url

Archived from the Transloadit support forum. Originally posted on February 8, 2012; details may be outdated, see our docs for current behavior. Original thread

My path is set to something like “/photo/${unique_prefix}/${previous_step.name}”. When upload to s3 the url for one result is for example “/photo/74/eaa5556250f3deb2bbb9c8eda8841e/:original”. But the id is “REDACTED”. There is a “/” inserted on char(3) inside ${unique_prefix}.

Is this a bug or a feature?

See “assembly_id”: “REDACTED”.

Hey rtl,

Many people do not properly create subfolders by default which leads to all files being added to the same folder. By using the first two chars of the file id to artificially create another subdirectory this problem is easily prevented.

This is not a bug, this is a feature. :slight_smile:

For me this is kind of annoying. I have to move all uploaded files to the “proper path”. Is there an option to deactivate this behavior?

Hey rtl,

well, you don’t have to use the ${unique_prefix} variable. :slight_smile: It is set to work this way with the slash in between, so adding a parameter to just control how unique_prefix works would be overkill.

However, if you just need a unique prefix for your upload, you could also use ${assembly.id}. Or there would be other meta information pieces that could qualify for this.
If this doesn’t help for your use case, you could also pass a unique prefix yourself to in the “path” string in your “params” field.

Please let me know why you need the unique prefix, then I can probably make better suggestions for your use case.

Kind regards
Tim

However, if you just need a unique prefix for your upload, you could also use ${assembly.id}.

I guess ${assembly.id} is the same for all processed files (in that assembly), right?

I would like to use a unique prefix (without slashes) file by file. Therefore using the ${assembly.id} or changing the “path”-paramenter won’t help because this affects all files in that upload. I really would like to use the “id” of the generated file. So it is ${unique_prefix} but without the added slash :frowning:

Hey,

you could try ${file.id} :slight_smile:

Eh… thank you, that’s it.
(I feel a little embarrassed now :slight_smile: