rshdhere commented on PR #6637:
URL: https://github.com/apache/fineract/pull/6637#issuecomment-6272766494

   Hi @galovics, thanks for the review. You're right on both points.
   
   I reworked it the way you suggested:
   
   - `ContentPolicyException` is back to how it is on develop, so the content 
store has no REST parameter in it any more.
   - `DocumentWritePlatformServiceImpl` now catches `ContentPolicyException` 
around `storeService`.`upload`(...) and rethrows it as a 
`PlatformApiDataValidationException` on file. This covers create and both 
upload paths in update.
   - Download and delete are unchanged. There the path comes from the stored 
doc.`getLocation`(), not from the request. So a policy failure on those paths 
means the stored data is bad, which is a server-side problem, and a 400 on file 
would be wrong there. I translate only on upload, so a 400 only comes back when 
the client actually sent something wrong.
   
   Tests: I replaced `ContentPolicyExceptionTest` with 
`DocumentWritePlatformServiceImplTest`, which checks the 400 validation error 
and that nothing is saved and no event is published. 
`DocumentTest`.`createDocumentNotAllowedFileType` still covers the real HTTP 
path.
   
   I also rebased onto the latest develop and ticked the AI Policy checkbox. 
Let me know if you'd rather have a dedicated mapper.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to