diff --git a/compliance_checker/cf/cf_1_6.py b/compliance_checker/cf/cf_1_6.py
index 4b45b3e9..d7fa6906 100644
--- a/compliance_checker/cf/cf_1_6.py
+++ b/compliance_checker/cf/cf_1_6.py
@@ -59,10 +59,11 @@ def __init__(self, options=None):  # initialize with parent methods and data
     def check_filename(self, ds):
         """Checks that the filename ends with .nc"""
         # IMPLEMENTS CONFORMANCE 2.1
+        filepath = ds.filepath()
         filename_suffix = TestCtx(BaseCheck.HIGH, self.section_titles["2.1"])
         filename_suffix.assert_true(
-            ds.filepath().endswith("nc"),
-            f'Dataset path {ds.filepath} must end with ".nc"',
+            filepath.endswith("nc"),
+            f'Dataset path {filepath} must end with ".nc"',
         )
         return filename_suffix.to_result()