diff --git a/package.json b/package.json index 4c234101..8c538dc2 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "start": "tsc && electron-forge start", "package": "tsc && electron-forge package", "make": "tsc && electron-forge make", - "setup:env": "cd servers/fastapi && poetry env remove --all && poetry install", + "setup:env": "npm install && cd servers/fastapi && poetry install && cd ../../servers/nextjs && npm install", "build:ts": "tsc", "build:css": "tailwindcss -i ./resources/ui/assets/tailwind.import.css -o ./resources/ui/assets/tailwind.css", "build:nextjs": "rm -rf resources/nextjs && mkdir -p resources/nextjs && cd servers/nextjs && npm run build && cp -r .next ../../resources/nextjs", diff --git a/servers/fastapi/api/routers/presentation/mixins/fetch_presentation_assets.py b/servers/fastapi/api/routers/presentation/mixins/fetch_presentation_assets.py index 9870200a..033f4a9e 100644 --- a/servers/fastapi/api/routers/presentation/mixins/fetch_presentation_assets.py +++ b/servers/fastapi/api/routers/presentation/mixins/fetch_presentation_assets.py @@ -21,8 +21,10 @@ class FetchPresentationAssetsMixin: image_name = replace_file_name( os.path.basename(parsed_url), str(uuid.uuid4()) ) - image_path = os.path.join(self.temp_dir, image_name) - image_local_paths.append(image_path) + image_path = os.path.join(self.temp_dir, image_name) + image_local_paths.append(image_path) + elif image_path.startswith("file://"): + image_path = image_path.replace("file://", "") each_shape.picture.path = image_path each_shape.picture.is_network = False diff --git a/servers/fastapi/api/routers/presentation/router.py b/servers/fastapi/api/routers/presentation/router.py index 2fb26a7d..53a1d7bc 100644 --- a/servers/fastapi/api/routers/presentation/router.py +++ b/servers/fastapi/api/routers/presentation/router.py @@ -288,7 +288,7 @@ async def search_icon(data: SearchIconRequest): @presentation_router.post( - "/presentation/export_as_pptx", response_model=PresentationAndUrl + "/presentation/export_as_pptx", response_model=PresentationAndPath ) async def export_as_pptx(data: ExportAsRequest): request_utils = RequestUtils("/ppt/presentation/export_as_pptx") @@ -301,7 +301,7 @@ async def export_as_pptx(data: ExportAsRequest): @presentation_router.post( - "/presentation/export_as_pdf", response_model=PresentationAndUrl + "/presentation/export_as_pdf", response_model=PresentationAndPath ) async def export_as_pdf(data: ExportAsRequest): request_utils = RequestUtils("/ppt/presentation/export_as_pdf") diff --git a/servers/fastapi/ppt_generator/pptx_presentation_creator.py b/servers/fastapi/ppt_generator/pptx_presentation_creator.py index 507ef46a..9bac33ec 100644 --- a/servers/fastapi/ppt_generator/pptx_presentation_creator.py +++ b/servers/fastapi/ppt_generator/pptx_presentation_creator.py @@ -268,7 +268,12 @@ class PptxPresentationCreator: or picture_model.object_fit or picture_model.shape ): - image = Image.open(image_path) + try: + image = Image.open(image_path) + except: + print(f"Could not open image: {image_path}") + return + image = image.convert("RGBA") # ? Applying border radius twice to support both clip and object fit if picture_model.border_radius: