X Tutup
Skip to content

Fix list queries erroring#11364

Merged
mekarpeles merged 1 commit intointernetarchive:masterfrom
cdrini:fix/list-queries
Oct 18, 2025
Merged

Fix list queries erroring#11364
mekarpeles merged 1 commit intointernetarchive:masterfrom
cdrini:fix/list-queries

Conversation

@cdrini
Copy link
Collaborator

@cdrini cdrini commented Oct 18, 2025

@cdrini cdrini marked this pull request as ready for review October 18, 2025 20:59
Copilot AI review requested due to automatic review settings October 18, 2025 20:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes errors occurring in list queries by improving the query parsing and parameter handling. The fix ensures proper extraction of list keys from query strings and handles null offset/limit values gracefully.

Key Changes:

  • Added type hints and default value handling for offset/limit parameters to prevent null reference errors
  • Replaced substring check with regex matching to properly extract and validate list keys from query strings
  • Used regex substitution to replace only the list key portion of the query while preserving other query parameters

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +1015 to +1019
q = re.sub(
r'^(/people/[^/]+)?/lists/OL\d+L',
f"key:({' OR '.join(book_keys)})" if book_keys else "-key:*",
q,
)
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern r'^(/people/[^/]+)?/lists/OL\\d+L' is duplicated from line 1008. Consider extracting this pattern into a named constant (e.g., LIST_KEY_PATTERN) to improve maintainability and ensure consistency if the pattern needs to be updated.

Copilot uses AI. Check for mistakes.
@mekarpeles mekarpeles self-assigned this Oct 18, 2025
@mekarpeles mekarpeles merged commit 4177060 into internetarchive:master Oct 18, 2025
4 checks passed
@cdrini cdrini deleted the fix/list-queries branch October 19, 2025 16:24
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.

ListCarousels erroring

3 participants

X Tutup