Skip to content

Revert part of #3373#3377

Merged
ildyria merged 3 commits intomasterfrom
remove-duplicate-code
May 27, 2025
Merged

Revert part of #3373#3377
ildyria merged 3 commits intomasterfrom
remove-duplicate-code

Conversation

@ildyria
Copy link
Copy Markdown
Member

@ildyria ildyria commented May 27, 2025

This pull request refactors the SecurePathController to improve the handling of signed URL validation by separating signature expiration and validity checks, and simplifies the getUrl method by removing unnecessary parameters and logic. Additionally, the hasCorrectSignature method has been removed in favor of using Laravel's built-in hasValidSignature method.

Note that this new functionality relies ENTIRELY on a proper Nginx configuration.

Improvements to signed URL validation:

  • Refactored the signature validation logic in SecurePathController to first check for signature expiration using signatureHasNotExpired and then validate the signature using Laravel's hasValidSignature method. This improves clarity and leverages framework capabilities. (app/Http/Controllers/SecurePathController.php, app/Http/Controllers/SecurePathController.phpL36-L54)

Simplification of URL generation:

  • Simplified the getUrl method by removing the $absolute parameter and redundant logic for handling query strings. The method now directly uses $request->url() combined with filtered query strings. (app/Http/Controllers/SecurePathController.php, app/Http/Controllers/SecurePathController.phpL75-R78)

Code cleanup:

  • Removed the custom hasCorrectSignature method, as its functionality is now replaced by Laravel's hasValidSignature method, reducing duplication and improving maintainability. (app/Http/Controllers/SecurePathController.php, app/Http/Controllers/SecurePathController.phpL75-R78)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.01%. Comparing base (de63f58) to head (a24fc9c).
Report is 3 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria changed the title Refactoring Revert part of #3373 May 27, 2025
@ildyria ildyria marked this pull request as ready for review May 27, 2025 19:28
@ildyria ildyria requested a review from a team as a code owner May 27, 2025 19:28
@ildyria ildyria added the Review: easy Easy review expected: probably just need a quick to go through. label May 27, 2025
@ildyria ildyria merged commit d9c363a into master May 27, 2025
35 checks passed
@ildyria ildyria deleted the remove-duplicate-code branch May 27, 2025 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review: easy Easy review expected: probably just need a quick to go through.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants