Skip to content

FileUriUtilTest fails on non-C drives in Windows due to hardcoded drive letter #5958

@Lee-WonJun

Description

@Lee-WonJun

Describe the bug
FileUriUtilTest fails on Windows when running from a drive other than C:.
This happens because normalizeFileUri() hardcodes the drive letter as "C" instead of detecting the current drive, causing URI mismatches in the tests.

To reproduce

  1. On Windows, place the project on a non-C: drive (e.g., F:).
  2. Open the project in a JetBrains IDE.
  3. Run FileUriUtilTest, TextDocumentServiceHandlerTest
  4. Tests that compare URIs (e.g., test basic unix path) will fail.

Expected behavior
On Windows, the drive letter in the URI should be based on the actual drive the project is running from.
Tests should pass regardless of whether the project is on C:, D:, F:, etc.

Screenshots

Image

Your Environment

  • OS: Windows 11
  • JetBrains product: IntelliJ IDEA Ultimate
  • JetBrains product version: IntelliJ IDEA 2025.1.3 (Ultimate Edition)
  • AWS Toolkit version: latest main branch / 3.90-SNAPSHOT / a8dadbb
  • SAM CLI version: N/A
  • JVM/Python version: corretto-21

Additional context
The normalizeFileUri() function should not hardcode the drive letter to C.
Instead, it should detect the current drive (e.g., via Paths.get("").toAbsolutePath().root or System.getenv("SystemDrive")) to ensure tests behave consistently across different drives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugWe can reproduce the issue and confirmed it is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions