Weird issue with whitespace in actionscript (or site permissions?)

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:

  1. 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.
  2. prefetch blocks have their own rules.
  3. Do 1] and 2] combine for bonkers interpreting of whitespace?
  4. 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

1 Like

Related, I’ve opened a git issue in the parameter documentation.

2 Likes

Hi,
‘parameter’ does support spaces. So both formats are safe.

About prefetch block, there are more restrictions because it depends on the download status of the items to collect. The indentation or white spaces cannot be the cause of a failure for an operator with a Reader permission. Your ticket will be used to catch the cause.