diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 7be99de6..ce0ffb7b 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -3538,7 +3538,11 @@ def getDriveFileAttribute(i, body, parameters, myarg, update=False): sys.argv[i+2], f'gam {operation} drivefile') i += 3 if len(sys.argv) > i and sys.argv[i].lower() == 'reason': - body['contentRestrictions'][0]['reason'] = sys.argv[i+1] + if body['contentRestrictions'][0]['readOnly']: + body['contentRestrictions'][0]['reason'] = sys.argv[i+1] + else: + controlflow.invalid_argument_exit( + 'reason', 'contentrestrictions readonly false') i += 2 else: controlflow.invalid_argument_exit( diff --git a/src/gam/var.py b/src/gam/var.py index f91affc9..6624c267 100644 --- a/src/gam/var.py +++ b/src/gam/var.py @@ -380,6 +380,7 @@ DRIVEFILE_FIELDS_CHOICES_MAP = { 'appdatacontents': 'appDataContents', 'cancomment': 'canComment', 'canreadrevisions': 'canReadRevisions', + 'contentrestrictions': 'contentRestrictions', 'copyable': 'copyable', 'copyrequireswriterpermission': 'copyRequiresWriterPermission', 'createddate': 'createdDate',