Skip to content

Commit 912fc7f

Browse files
committed
add save() method to CodebaseResource to ensure parent_directory_path is always set
Signed-off-by: Aayush Kumar <aayush214.kumar@gmail.com>
1 parent 1d4bd0f commit 912fc7f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scanpipe/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,6 +2796,11 @@ class Meta:
27962796
def __str__(self):
27972797
return self.path
27982798

2799+
def save(self, *args, **kwargs):
2800+
if self.path and not self.parent_directory_path:
2801+
self.parent_directory_path = parent_directory(str(self.path), with_trail=False)
2802+
super().save(*args, **kwargs)
2803+
27992804
@property
28002805
def location_path(self):
28012806
"""Return the location of the resource as a Path instance."""

0 commit comments

Comments
 (0)