dspace-angular icon indicating copy to clipboard operation
dspace-angular copied to clipboard

Invalid (>30 char length) policy names are allowed by angular in create / edit resource policy

Open kshepherd opened this issue 3 years ago • 3 comments

Describe the bug The resource policy name column in DSpace has a character limit of 30 characters. Angular will allow any length in the "name" field of a resource policy create/edit form anyway, and report a generic 500 Server Error if the length of the name is above 30 characters.

Caused by: java.sql.BatchUpdateException: Batch entry 0 update public.resourcepolicy set action_id=13, dspace_objec
t='a3d46767-8cbd-4cea-915f-c3f055ffab01'::uuid, end_date=NULL, eperson_id='26db1627-b362-4602-82a9-6deb6c27aedd'::u
uid, epersongroup_id=NULL, resource_type_id=2, rpdescription='adsf', rpname='test hidden metadata read on item', rp
type='TYPE_CUSTOM', start_date=NULL where policy_id=41 was aborted: ERROR: value too long for type character varyin
g(30)  Call getNextException to see other errors in the batch.

To Reproduce Steps to reproduce the behavior:

  1. Create or edit a resource policy on an item (or other DSO)
  2. Set the the name of the policy and try to save it. Note the displayed error and the logged hibernate error

Expected behavior

  1. Form validation that warns / restricts users from saving a policy with an invalid name.
  2. Better handling in backend rest / API service so that a more useful error can be thrown? (not an angular issue but noting here)

kshepherd avatar Jul 06 '22 21:07 kshepherd

we (at 4Science) can work on that. REST implementation (to return a 422 instead than the 500) would take 6 hours. The constraint could be relaxed to a wider size (100).

The angular part would take 4 hrs. Total estimation 10 hours

abollini avatar Oct 20 '22 11:10 abollini

we (at 4Science) can work on that. REST implementation (to return a 422 instead than the 500) would take 6 hours. The constraint could be relaxed to a wider size (100).

The angular part would take 4 hrs. Total estimation 10 hours

abollini avatar Oct 20 '22 11:10 abollini

Thanks @abollini ! Assigning to you for your team to work on for 7.5. I'll add the estimate as well.

tdonohue avatar Oct 20 '22 20:10 tdonohue

unclaiming as we have other priorities as volunteer work

abollini avatar Mar 16 '23 14:03 abollini

Closing as this was fixed by #2973 in 7.6.2 and 8.0

tdonohue avatar Jul 12 '24 17:07 tdonohue