Repository: spdx/tools-python

Issue:
Change fileName validation
- file names do not have to start with `./`
- file names must not start with `/`

Discussion:

Patch:
diff --git a/src/spdx/validation/file_validator.py b/src/spdx/validation/file_validator.py
index cc4375e..16845e5 100644
--- a/src/spdx/validation/file_validator.py
+++ b/src/spdx/validation/file_validator.py
@@ -50,10 +50,10 @@ def validate_file(file: File, context: Optional[ValidationContext] = None) -> Li
     if not context:
         context = ValidationContext(spdx_id=file.spdx_id, element_type=SpdxElementType.FILE, full_element=file)
 
-    if not file.name.startswith("./"):
+    if file.name.startswith("/"):
         validation_messages.append(
             ValidationMessage(
-                f'file name must be a relative path to the file, starting with "./", but is: {file.name}', context)
+                f'file name must not be an absolute path starting with "/", but is: {file.name}', context)
         )
 
     if ChecksumAlgorithm.SHA1 not in [checksum.algorithm for checksum in file.checksums]:


Test patch:
diff --git a/tests/spdx/validation/test_file_validator.py b/tests/spdx/validation/test_file_validator.py
index 040edde..d06a24d 100644
--- a/tests/spdx/validation/test_file_validator.py
+++ b/tests/spdx/validation/test_file_validator.py
@@ -27,9 +27,9 @@ def test_valid_file():
 
 
 @pytest.mark.parametrize("file_input, spdx_id, expected_message",
-                         [(file_fixture(name="invalid file name"), file_fixture().spdx_id,
-                           'file name must be a relative path to the file, starting with "./", but is: invalid file name'),
-                          (
+                         [(file_fixture(name="/invalid/file/name"), file_fixture().spdx_id,
+                           f'file name must not be an absolute path starting with "/", but is: /invalid/file/name'),
+                         (
                           file_fixture(checksums=[Checksum(ChecksumAlgorithm.MD2, "d4c41ce30a517d6ce9d79c8c17bb4b66")]),
                           file_fixture().spdx_id,
                           f'checksums must contain a SHA1 algorithm checksum, but only contains: [<ChecksumAlgorithm.MD2: 13>]')