Hi all,
Have you found action script to be picky about whitespace formatting? We’ve lately experienced an issue which was “corrected” by making formatting consistent.
The original code:
begin prefetch block
parameter "theFile" = "foo.file"
parameter "theSha1" = "sha1nonsense"
parameter "theSize" = "123456"
parameter "theUrl" = "https://fqdn.internal/folder/foo.file"
add prefetch item name={parameter "theFile"} sha1={parameter "theSha1"} size={parameter "theSize"} url={parameter "theUrl"}
collect prefetch items
end prefetch block
When deployed by our team (operators with Writer site permission), this executes just fine. When executed by an operator with Reader permission, the action fails.
The console view indicates that it failed with a “syntax” error at the line parameter "theFile" = "foo.file"
.
The client log contains this:
ActionLogMessage: (action:654321) Parameter command error. Parameter may not already be defined.
ActionLogMessage: (action: 654321) ending action
After reading a thread about spaces around the =
, I wondered if the inconsistent indenting and whitespace might be an issue. (Our content templates routinely use indenting for visual clarity, and parameters with spaces next to the =
.) After changing the code to normalize indenting…
begin prefetch block
parameter "theFile" = "foo.file"
parameter "theSha1" = "sha1nonsense"
parameter "theSize" = "123456"
parameter "theUrl" = "https://fqdn.internal/folder/foo.file"
add prefetch item name={parameter "theFile"} sha1={parameter "theSha1"} size={parameter "theSize"} url={parameter "theUrl"}
collect prefetch items
end prefetch block
…it runs fine from all operators.
So… why? I can think of a few things that might be at play:
- Formatting rules for
parameter
are unclear. As of this writing, the parameter documentation remains inconsistent about whether spaces are allowed, or should or should not be used. prefetch
blocks have their own rules.- Do 1] and 2] combine for bonkers interpreting of whitespace?
- Do an operator’s permissions for the content site come into play? (I can’t imagine how; if you’re a Reader you’re a Reader… right? But here we are.)
Thanks for any insight!
-Andrew