Skip to content

Commit 94c276f

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 ecb4ab6 commit 94c276f

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
@@ -2812,6 +2812,11 @@ class Meta:
28122812
def __str__(self):
28132813
return self.path
28142814

2815+
def save(self, *args, **kwargs):
2816+
if self.path and not self.parent_directory_path:
2817+
self.parent_directory_path = parent_directory(str(self.path), with_trail=False)
2818+
super().save(*args, **kwargs)
2819+
28152820
def get_absolute_url(self):
28162821
return reverse("resource_detail", args=[self.project.slug, self.path])
28172822

0 commit comments

Comments
 (0)