Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@BaranTeyin1 here is the fix which should hopefully cover about all the edge cases I could think of.
This pull request introduces a new validation rule for photo URLs, enhances configuration options for URL import security, and updates the application version. The most important changes include the addition of the
PhotoUrlRule
class for URL validation, updates to theFromUrlRequest
rules to use this new validation rule, and the inclusion of database migrations for new configuration settings. Additionally, unit tests have been added to ensure the correctness of the new validation logic.Validation Enhancements
PhotoUrlRule
class to validate photo URLs, ensuring they are syntactically correct and comply with security restrictions such as requiring HTTPS, disallowing private IPs, and forbidding certain ports (app/Rules/PhotoUrlRule.php
).FromUrlRequest
rules to apply thePhotoUrlRule
for validating individual URLs in theurls
array (app/Http/Requests/Photo/FromUrlRequest.php
). [1] [2]Configuration Updates
database/migrations/2025_06_26_102340_parse_url_options.php
).Testing Improvements
PhotoUrlRule
to validate various scenarios, such as invalid URLs, forbidden schemes, and restricted ports or IPs (tests/Unit/Rules/PhotoUrlRuleTest.php
).Version Update
6.6.12
to6.6.13
to reflect the new features and changes (version.md
,database/migrations/2025_06_26_115949_bump_version060613.php
). [1] [2]