Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 24, 2026

  • Analyze the issue: Square brackets in path are incorrectly URL-encoded
  • Identify the bug: encodePath() uses %91 and %93 instead of %5B and %5D for [ and ]
  • Fix the incorrect encoding in Absolute.java
  • Verify all other character encodings are correct (all verified ✓)
  • Add comprehensive tests for square brackets handling in all variants
  • Run tests to verify the fix (21 tests pass)
  • Run code review and security checks (no issues found)
  • Run licenseFormat and gradlew check (BUILD SUCCESSFUL)
Original prompt

Проверить, корректно ли обрабатываются квадратные скобки в пути во всех вариантах построения Absolute.uri и Absolute.path


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copilot AI changed the title [WIP] Check square brackets handling in Absolute.uri and Absolute.path Fix incorrect URL encoding for square brackets in Absolute.encodePath() Jan 24, 2026
Copilot AI requested a review from nixel2007 January 24, 2026 19:30
@nixel2007 nixel2007 marked this pull request as ready for review January 24, 2026 19:30
Copilot AI review requested due to automatic review settings January 24, 2026 19:30
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@nixel2007
Copy link
Member

@copilot запусти licenseFormat.
gradlew check должен проходить успешно.

Copy link

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

Fixes incorrect percent-encoding of square brackets in Absolute.encodePath() so URIs are generated with RFC-compliant encodings.

Changes:

  • Correct [/] encoding from %91/%93 to %5B/%5D in encodePath().
  • Add unit tests covering bracket handling across Absolute.uri(...) and Absolute.path(...) overloads.

Reviewed changes

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

File Description
src/main/java/com/github/_1c_syntax/utils/Absolute.java Fixes the actual bracket percent-encoding in encodePath().
src/test/java/com/github/_1c_syntax/utils/AbsoluteTest.java Adds regression tests for bracket-containing paths/URIs across input variants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +265 to +268
assertThat(uri.toString()).doesNotContain("[");
assertThat(uri.toString()).doesNotContain("]");
assertThat(uri.getPath()).contains("[folder]");
assertThat(uri.getPath()).endsWith("test[1].bsl");
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

These assertions verify that brackets are absent from the serialized URI, but they don’t explicitly validate that the encoding is the expected %5B / %5D (and not another percent sequence). Consider asserting against uri.getRawPath() (or uri.toString()) that it contains %5B and %5D (optionally also asserting it does not contain %91 / %93) to make the regression test directly cover the bug being fixed.

Copilot uses AI. Check for mistakes.
Comment on lines +281 to +284
assertThat(uri.toString()).doesNotContain("[");
assertThat(uri.toString()).doesNotContain("]");
assertThat(uri.getPath()).contains("[folder]");
assertThat(uri.getPath()).endsWith("test[1].bsl");
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

Same as above: this checks that [/] don’t appear in the URI string, but it doesn’t assert the actual percent-encoding used. Adding an assertion on uri.getRawPath()/uri.toString() for %5B and %5D (and/or absence of %91/%93) would make the test directly validate the intended fix.

Copilot uses AI. Check for mistakes.
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 24, 2026

@copilot запусти licenseFormat.
gradlew check должен проходить успешно.

Done in d3fd7d5. gradlew check passes successfully.

@sonarqubecloud
Copy link

@nixel2007 nixel2007 merged commit 3226bd4 into master Jan 24, 2026
14 checks passed
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.

2 participants