Skip to content

Validate the requested image exists within the project - #1665

Merged
cpeel merged 1 commit into
DistributedProofreaders:masterfrom
cpeel:validate-page-exists
Oct 5, 2026
Merged

cpeel merged 1 commit into
DistributedProofreaders:masterfrom
cpeel:validate-page-exists

Conversation

@cpeel

@cpeel cpeel commented Sep 30, 2026

Copy link
Copy Markdown
Member

Diff links from other pages should always have valid $image values for a project, but if the user is adjusting the URL by hand the image they request might not exist in the project.

This validation ensures that the rest of the page works instead of these from the php_errors file:

29-Sep-2026 23:02:12 America/New_York
    PHP Warning:  foreach() argument must be of type array|object, null given in /data/htdocs/c/tools/project_manager/diff.php on line 332
    TypeError: get_navigation(): Argument #5 ($L_user) must be of type string, null given, called in /data/htdocs/c/tools/project_manager/diff.php on line 114 and defined in /data/htdocs/c/tools/project_manager/diff.php:185
Stack trace:
#0 /data/htdocs/c/tools/project_manager/diff.php(114): get_navigation()
#1 {main}

@cpeel
cpeel requested review from bpfoley and srjfoo September 30, 2026 18:25
@cpeel cpeel self-assigned this Sep 30, 2026

@bpfoley bpfoley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This makes the if (!$project->pages_table_exists) { ... } below redundant (get_project_page checks that first, and throws an exception).

@cpeel
cpeel force-pushed the validate-page-exists branch from 3ecc092 to 7baf855 Compare October 5, 2026 18:42
@cpeel

cpeel commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

This makes the if (!$project->pages_table_exists) { ... } below redundant (get_project_page checks that first, and throws an exception).

Good catch. And the user will get an error exception for that specifically as well, so we can remove the now-redundant check.

@cpeel
cpeel merged commit 3d1814c into DistributedProofreaders:master Oct 5, 2026
12 checks passed
@cpeel
cpeel deleted the validate-page-exists branch October 5, 2026 18:49
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.

3 participants