From b3050350c76e0a1335d06b78460f7aa2c29df267 Mon Sep 17 00:00:00 2001 From: Mohammed Mohsin <59914433+mdmohsin7@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:49:17 +0530 Subject: [PATCH 1/2] use only ulid for apps id --- backend/routers/apps.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/routers/apps.py b/backend/routers/apps.py index 4906962f6..80381e55b 100644 --- a/backend/routers/apps.py +++ b/backend/routers/apps.py @@ -43,8 +43,7 @@ def submit_app(app_data: str = Form(...), file: UploadFile = File(...), uid=Depe data['deleted'] = False data['status'] = 'under-review' data['name'] = data['name'].strip() - new_app_id = slugify(data['name']) + '-' + str(ULID()) - data['id'] = new_app_id + data['id'] = str(ULID()) if external_integration := data.get('external_integration'): # check if setup_instructions_file_path is a single url or a just a string of text if external_integration.get('setup_instructions_file_path'): From e19670ed14a946c12f7b9f8dc28c7c56d524a435 Mon Sep 17 00:00:00 2001 From: Mohammed Mohsin <59914433+mdmohsin7@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:50:18 +0530 Subject: [PATCH 2/2] remove slugify import --- backend/routers/apps.py | 1 - backend/routers/plugins.py | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/backend/routers/apps.py b/backend/routers/apps.py index 80381e55b..7c3f30668 100644 --- a/backend/routers/apps.py +++ b/backend/routers/apps.py @@ -5,7 +5,6 @@ import requests from ulid import ULID from fastapi import APIRouter, Depends, Form, UploadFile, File, HTTPException, Header -from slugify import slugify from database.apps import change_app_approval_status, get_unapproved_public_apps_db, \ add_app_to_db, update_app_in_db, delete_app_from_db, update_app_visibility_in_db diff --git a/backend/routers/plugins.py b/backend/routers/plugins.py index 91a074da9..8fa813435 100644 --- a/backend/routers/plugins.py +++ b/backend/routers/plugins.py @@ -8,7 +8,6 @@ import requests from fastapi import APIRouter, HTTPException, Depends, UploadFile from fastapi.params import File, Form -from slugify import slugify from ulid import ULID from database.apps import add_app_to_db @@ -116,8 +115,7 @@ def add_plugin(plugin_data: str = Form(...), file: UploadFile = File(...), uid=D data = json.loads(plugin_data) data['approved'] = False data['name'] = data['name'].strip() - new_app_id = slugify(data['name']) + '-' + str(ULID()) - data['id'] = new_app_id + data['id'] = str(ULID()) os.makedirs(f'_temp/plugins', exist_ok=True) file_path = f"_temp/plugins/{file.filename}" with open(file_path, 'wb') as f: