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

API Cache Manager route uses case-insensitive match #3780

Merged
merged 2 commits into from
Jan 4, 2025

Conversation

nichwall
Copy link
Contributor

@nichwall nichwall commented Jan 3, 2025

Brief summary

Fix case-sensitive matching for API Cache Manager.

Which issue is fixed?

CodeQL issue from PR #3335.
Workflow output: https://github.com/advplyr/audiobookshelf/pull/3335/checks?check_run_id=35084757148

In-depth Description

#3335 (comment)
This PR changes the regex path matching to be case insensitive for the API Cache Manager. Two methods I found were to force all request URLs to be lowercase, or to ensure that the regex matches against a case-insensitive string. I chose to use case-insensitive matching for now due to some routes potentially being case sensitive, such as:
DELETE /api/tags/:tag
DELETE /api/genres/:genre

How have you tested this?

I changed various API calls in the web client to use various capitalization for library API endpoints and verified that everything was still routed correctly. The API Cache Manager continued to have cache hits and return data correctly.

Screenshots

N/A

@nichwall nichwall changed the title Api cache case insensitive API Cache Manager route uses case-insensitive match Jan 3, 2025
@advplyr
Copy link
Owner

advplyr commented Jan 4, 2025

Thanks!

@advplyr advplyr merged commit f366dfa into advplyr:master Jan 4, 2025
5 checks passed
@nichwall nichwall deleted the api_cache_case_insensitive branch January 4, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants