Commit 61bb2ef0 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

fix upload

parent 3d10180c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -61,6 +61,11 @@ class Project(models.Model):
    def __str__(self):
        return self.label

    @property
    def root_collection(self) -> "Collection":
        col, _ = Collection.objects.get_or_create(project=self, parent=None)
        return col


class Tag(models.Model):
    uid = models.TextField()
+1 −1
Original line number Diff line number Diff line
@@ -490,7 +490,7 @@ def add_collection_from_path(user: User, path: str, project_id: int) -> List[Dic
        raise ServiceException(NO_SUCH_PROJECT)
    _check_project_permission(user, project, PERM_COLLECTION_CREATE)
    hierarchy = []
    previous_dir = Collection.objects.get(parent=None, project=project)
    previous_dir = project.root_collection
    for dir_name in path.split("/"):
        # force ascii representation of unicode strings
        dir_name = unidecode.unidecode(dir_name.strip())
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ def _collection_from_origin_dir(
    origin_dir: str, project: models.Project
) -> Union[models.Collection, None]:
    # root dir always first
    previous_dir = models.Collection.objects.get(title="root", parent=None)
    previous_dir = project.root_collection
    for dir_name in origin_dir.split("/"):
        dir_name = dir_name.strip()
        if not dir_name: