Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle badly formatted last_audit_date in StoreAssetRequest #14488

Conversation

marcusmoore
Copy link
Collaborator

Description

This PR follows up #14486 and handles users providing an non-dates for last_audit_date. The issue is Carbon will blow up trying to parse that field so I wrapped the parsing in a try/catch and if the value is not parsable I leave it alone so it can be picked up by the request's validation (the changes being made are in prepareForValidation()).

Huge thanks to @spencerrlongg for pointing this out.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Copy link

what-the-diff bot commented Mar 25, 2024

PR Summary

  • Implementation of new InvalidFormatException
    A new type of error, the InvalidFormatException, was introduced into StoreAssetRequest.php for better error handling.

  • Refinement in prepareForValidation() method
    The prepareForValidation() method in StoreAssetRequest.php was updated to utilize a new function parseLastAuditDate(). This makes the process of modifying the last_audit_date more efficient and organized.

  • New Method parseLastAuditDate()
    A new function, parseLastAuditDate(), was added into StoreAssetRequest.php. This method is purposed for parsing and formatting the last_audit_date field, improving the overall data management for this field.

  • Added Validity Confirmation Test
    A new test, testNonDateUsedForLastAuditDateReturnsValidationError(), was implemented in AssetStoreTest.php. Its role is to check for validation errors when a non-date value is utilized for last_audit_date, ensuring the integrity and correctness of the data.

@snipe snipe merged commit 67b5e90 into snipe:develop Mar 25, 2024
8 checks passed
@marcusmoore marcusmoore deleted the bug/pass-last-audit-date-through-for-validation branch March 25, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants