Skip to content

Normalized file permissions during replacement - #1110

Open
girishpanchal30 wants to merge 4 commits into
developmentfrom
bugfix/1107
Open

Normalized file permissions during replacement#1110
girishpanchal30 wants to merge 4 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 35745b0 is ready 🛎️!

@pirate-bot

pirate-bot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

🌍 i18n String Review Report

📊 Summary

Category Count
➕ Added 1
➖ Removed 0
🔄 Changed 0
Total 1
➕ Added Strings (1) - Click to expand
String Location Words Suggested Match
The permissions may not have been updated, so t... inc/media_rename/attachmen... 17 No close match
Total 17

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' )

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