Skip to content

On propertybag set, remove the error that is thrown if a site has NoScript enabled #6459

@martinlingstuyl

Description

@martinlingstuyl

Currently, in our spo properybag set command, we check if a site has NoScript enabled, and throw an error if it does.

However, as explained in 6458 this restriction can be lifted if you configure a tenant-wide property.

I'm thinking we should remove the thrown error, so that the command can just be executed. If it is a NoScript site, and the setting has not been configured, it will throw an error anyway. But that's okay I guess.

I'm talking about this code in propertybag-set.ts:

// Check if web no script enabled or not
// Cannot set property bag value if no script is enabled
const isNoScriptSite = await this.isNoScriptSite(identityResp, args.options, logger);

if (isNoScriptSite) {
  throw 'Site has NoScript enabled, and setting property bag values is not supported';
}

The error that will now be thrown is:

Error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

That is quite generic and can mean anything. To help people along to a possible solution we want to show a warning below the error:

Tip: If a site has NoScript enabled, setting the property bag value may result in exceptions.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions