diff --git a/library/files/file b/library/files/file
index 8d3a71a2379..0e50cb67e89 100644
--- a/library/files/file
+++ b/library/files/file
@@ -189,7 +189,7 @@ def main():
 
     elif state in ['link','hard']:
 
-        if os.path.isdir(path):
+        if os.path.isdir(path) and not os.path.islink(path):
             relpath = path
         else:
             relpath = os.path.dirname(path)