Skip to content

Content reference in formRequest dictionary leaves literal "$" before variable token #198

Description

@BsnizND

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:

  1. The content reference compiles to only the variable token:
"string": "",
"attachmentsByRange": {
  "{0, 1}": { "VariableName": "fileInput", "Type": "Variable" }
}
  1. 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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions