Skip to content

Normalized file permissions during replacement - #1110

Merged
pirate-bot merged 5 commits into
developmentfrom
bugfix/1107
Sep 2, 2026
Merged

Normalized file permissions during replacement#1110
pirate-bot merged 5 commits into
developmentfrom
bugfix/1107

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

Checked the file permissions and added a fallback to update them if the filesystem abstraction fails. If the permissions still cannot be updated, a message is returned asking the user to update them manually.

Closes #1107

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@pirate-bot

pirate-bot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Plugin build for 93d68e2 is ready 🛎️!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Normalizes permissions after media replacement to prevent inaccessible attachments.

Changes:

  • Adds native chmod() fallback and permission verification.
  • Returns a user-facing error when normalization fails.
  • Adds a restricted-file permission test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
inc/media_rename/attachment_replace.php Implements permission normalization and failure reporting.
tests/media_rename/test-attachment-replace.php Tests replacement of a 0600 file.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread inc/media_rename/attachment_replace.php Outdated
Comment thread inc/media_rename/attachment_replace.php Outdated
Comment thread tests/media_rename/test-attachment-replace.php

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

inc/media_rename/attachment_replace.php:108

  • This message is ambiguous: “it” appears to refer to the plural “permissions,” and “may not be updated” understates a failure that has already been verified. Name the replacement file explicitly and tell the user that manual action is required.
				__( 'The permissions may not be updated, so it isn\'t publicly accessible. Please update the permissions.', 'optimole-wp' )

The permission failure isn't actionable by the user, so reuse the
already-translated "Error replacing file" string instead of adding a new
untranslated one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@pirate-bot
pirate-bot merged commit 141bd2e into development Sep 2, 2026
11 checks passed
@pirate-bot
pirate-bot deleted the bugfix/1107 branch September 2, 2026 17:01
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.

5 participants