Skip to content

error.directory.unallowed_name not raised on Windows for absolute directory_path_name #1539

@jordanpadams

Description

@jordanpadams

Checked for duplicates

Yes - I've already checked

🐛 Describe the bug

When validating a PDS4 label containing a directory_path_name value that starts with / (e.g. /test/meca_rdr_sis_files/), the error.directory.unallowed_name error is raised on Linux/macOS but not on Windows.

The root cause is in FileReferenceValidationRule.java: the code uses java.nio.file.Path.isAbsolute() to detect absolute paths, which is OS-dependent. On Windows, Path.isAbsolute() returns false for paths that start with / but lack a drive letter (e.g. C:\) — Java treats these as "drive-relative" rather than absolute. On Linux/macOS, the same path correctly returns true.

First identified as a cross-platform inconsistency in NASA-PDS/pds4-information-model#1001.

🕵️ Expected behavior

error.directory.unallowed_name should be raised on all platforms when directory_path_name contains an absolute path (starts with /), since PDS4 uses forward-slash separators by definition and the check should be platform-independent.

📜 To Reproduce

  1. Create a PDS4 label with <directory_path_name>/test/meca_rdr_sis_files/</directory_path_name>
  2. Run validate on Windows
  3. Observe that error.directory.unallowed_name is not raised (only error.label.schema is raised)
  4. Run the same validate command on Linux/macOS
  5. Observe that error.directory.unallowed_name is raised

🖥 Environment Info

  • Version of this software: v4.0.1
  • Operating System: Windows (missing error) vs Linux/macOS (correct behavior)

📚 Version of Software Used

v4.0.1

🩺 Test Data / Additional context

See Product_Document_FAIL_pathname_20260316.xml (file06: <directory_path_name>/test/meca_rdr_sis_files/</directory_path_name>).

Fix: Replace Paths.get(FilenameUtils.getFullPath(directory)).isAbsolute() with directory.startsWith("/") in FileReferenceValidationRule.java.

Related: NASA-PDS/pds4-information-model#1001


For Internal Dev Team To Complete

⚙️ Engineering Details

🎉 Integration & Test

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

🏁 Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions