Summary
When a content reference is used inside a dictionary passed to formRequest, Cherri leaves a literal $ before the Shortcuts variable token in the compiled plist.
This is surprising for multipart/form uploads because the form field becomes a text token string that starts with $, instead of a clean variable token. For file/image upload fields, that can prevent the receiving server from treating the field as the intended uploaded file value.
Minimal repro
#include 'actions/web'
#define name Test Upload
@fileInput = ShortcutInput
@response = formRequest(
"https://example.com/upload",
"POST",
{
"file": "${@fileInput}",
"title": "hello"
},
{}
)
Actual compiled plist shape
In the generated WFFormValues dictionary, the file field compiles roughly like this:
{
"WFKey": { "Value": { "string": "file" } },
"WFValue": {
"Value": {
"string": "$",
"attachmentsByRange": {
"{1, 1}": { "VariableName": "fileInput", "Type": "Variable" }
}
},
"WFSerializationType": "WFTextTokenString"
}
}
The important part is "string": "$".
Expected behavior
I would expect either:
- The content reference compiles to only the variable token:
"string": "",
"attachmentsByRange": {
"{0, 1}": { "VariableName": "fileInput", "Type": "Variable" }
}
- Or Cherri fails loudly / documents that
${...} content references are not supported inside dictionary values passed to actions such as formRequest.
Workaround
Using this inside the form dictionary works for this case:
{
"file": "{@fileInput}",
"title": "hello"
}
That compiles the field value as a pure variable token with no literal $ prefix.
Environment
- Cherri version: v2.3.0 release binary for macOS arm64
- Command included
--derive-uuids --skip-sign --debug
Thanks for Cherri. It is making generated Shortcuts much easier to maintain; this one just took a little plist inspection to notice.
Summary
When a content reference is used inside a dictionary passed to
formRequest, Cherri leaves a literal$before the Shortcuts variable token in the compiled plist.This is surprising for multipart/form uploads because the form field becomes a text token string that starts with
$, instead of a clean variable token. For file/image upload fields, that can prevent the receiving server from treating the field as the intended uploaded file value.Minimal repro
Actual compiled plist shape
In the generated
WFFormValuesdictionary, thefilefield compiles roughly like this:{ "WFKey": { "Value": { "string": "file" } }, "WFValue": { "Value": { "string": "$", "attachmentsByRange": { "{1, 1}": { "VariableName": "fileInput", "Type": "Variable" } } }, "WFSerializationType": "WFTextTokenString" } }The important part is
"string": "$".Expected behavior
I would expect either:
${...}content references are not supported inside dictionary values passed to actions such asformRequest.Workaround
Using this inside the form dictionary works for this case:
That compiles the field value as a pure variable token with no literal
$prefix.Environment
--derive-uuids --skip-sign --debugThanks for Cherri. It is making generated Shortcuts much easier to maintain; this one just took a little plist inspection to notice.