Skip to content

Use untrailingslashit() on server_path#170

Merged
BrianHenryIE merged 2 commits intomainfrom
PRESS0-2763/remove-trailing-slash-from-server-path
May 23, 2025
Merged

Use untrailingslashit() on server_path#170
BrianHenryIE merged 2 commits intomainfrom
PRESS0-2763/remove-trailing-slash-from-server-path

Conversation

@BrianHenryIE
Copy link
Copy Markdown
Contributor

Proposed changes

Type of Change

Production

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update
  • Refactoring / housekeeping (changes to files not directly related to functionality)

Development

  • Tests
  • Dependency update
  • Environment update / refactoring
  • Documentation Update

Video

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Copilot AI review requested due to automatic review settings May 22, 2025 19:30
Copy link
Copy Markdown
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 ensures that the server_path value returned by get_core_data() has no trailing slash by applying untrailingslashit(), and updates the corresponding test to expect the stripped value.

  • Wrap server_path in untrailingslashit() in the production code
  • Add a mock for untrailingslashit() and update the expected value in the PHPUnit test

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
includes/HiiveConnection.php Apply untrailingslashit() to the server_path entry
tests/phpunit/includes/HiiveConnectionTest.php Mock untrailingslashit() and update the expected server_path
Comments suppressed due to low confidence (1)

tests/phpunit/includes/HiiveConnectionTest.php:122

  • Add a test case where ABSPATH is undefined or empty to verify that server_path falls back to an empty string without errors.
self::assertEquals( '/path/on/server', $result['server_path'] );

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 22, 2025

@BrianHenryIE BrianHenryIE requested a review from fralicandro May 22, 2025 21:28
@BrianHenryIE BrianHenryIE merged commit 9157ee3 into main May 23, 2025
12 of 13 checks passed
@BrianHenryIE BrianHenryIE deleted the PRESS0-2763/remove-trailing-slash-from-server-path branch May 23, 2025 15:10
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