Assigning an empty string to a string property within Document.metadataPreferences (such as copyrightNotice) fails to clear it. The assignment is silently ignored, and the existing string remains unchanged. You can change it to any value, but not an empty-ish string.
Example from UXP Dev Tools Console):
> doc.metadataPreferences["copyrightNotice"] = "TEST"
"TEST"
> doc.metadataPreferences["copyrightNotice"] = "" # trying to set empty string
""
> doc.metadataPreferences["copyrightNotice"]
"TEST" # should be ''
> doc.metadataPreferences["copyrightNotice"] = "TEST UPDATE"
"TEST UPDATE"
> doc.metadataPreferences["copyrightNotice"]
"TEST UPDATE" # updating the string worked
> doc.metadataPreferences["copyrightNotice"] = '' # trying single quote empty string
""
> doc.metadataPreferences["copyrightNotice"]
"TEST UPDATE" # the previous state remained, field wasn't emptied
> doc.metadataPreferences["copyrightNotice"] = " " # trying one space as "empty-ish" string
" "
> doc.metadataPreferences["copyrightNotice"]
"TEST UPDATE" # did not work
> doc.metadataPreferences["copyrightNotice"] = "\n" # trying a line break as another whitespace character
"\n"
> doc.metadataPreferences["copyrightNotice"]
"\n" # changing to a line break worked, seems to not be considered empty
Expected Behavior:
Assigning an empty string should clear the metadata property.
Actual Behavior:
The empty string assignment is silently ignored. The property retains its previously set value.
Additional Context:
- Attempting to clear the property with
nullorundefinedis not possible, as it throws a strict type error:Uncaught Error: Invalid value for property setup 'copyrightNotice'. Expected String, but received nothing. - The issue occurs both within UXP plugins and directly in the UXP JS Console.`
Environment:
- Application: Adobe InDesign 21.2
- API: UXP Scripting