From ba226bae5c0c4f306b6593cfc6c91ac602244e87 Mon Sep 17 00:00:00 2001 From: Shane Israel Date: Thu, 28 Aug 2025 12:49:13 -0600 Subject: [PATCH 1/2] Fix for links and derived data not properly being removed when deleting a video --- app/server/fireshare/api.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/app/server/fireshare/api.py b/app/server/fireshare/api.py index 16d290e4..013c2ca2 100644 --- a/app/server/fireshare/api.py +++ b/app/server/fireshare/api.py @@ -190,18 +190,25 @@ def delete_video(id): VideoInfo.query.filter_by(video_id=id).delete() Video.query.filter_by(video_id=id).delete() db.session.commit() - file_path = f"{current_app.config['VIDEO_DIRECTORY']}/{video.path}" - link_path = f"{current_app.config['PROCESSED_DIRECTORY']}/video_links/{id}.{video.extension}" - derived_path = f"{current_app.config['PROCESSED_DIRECTORY']}/derived/{id}" + + # Use the PATHS config for consistent path handling + paths = current_app.config['PATHS'] + file_path = paths['video'] / video.path + link_path = paths['processed'] / 'video_links' / f"{id}.{video.extension}" + derived_path = paths['processed'] / 'derived' / id + try: - if os.path.exists(file_path): - os.remove(file_path) - if os.path.exists(link_path): - os.remove(link_path) - if os.path.exists(derived_path): + if file_path.exists(): + file_path.unlink() + logging.info(f"Deleted video file: {file_path}") + if link_path.exists(): + link_path.unlink() + logging.info(f"Deleted link file: {link_path}") + if derived_path.exists(): shutil.rmtree(derived_path) + logging.info(f"Deleted derived directory: {derived_path}") except OSError as e: - logging.error(f"Error deleting: {e.strerror}") + logging.error(f"Error deleting files for video {id}: {e}") return Response(status=200) else: From 2acc39a0595020953386593aa825f5802b3a7923 Mon Sep 17 00:00:00 2001 From: Shane Israel Date: Thu, 28 Aug 2025 12:49:56 -0600 Subject: [PATCH 2/2] up the version --- app/client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/package.json b/app/client/package.json index f9b8c2a3..8c78b316 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -1,6 +1,6 @@ { "name": "fireshare", - "version": "1.2.28", + "version": "1.2.29", "private": true, "dependencies": { "@emotion/react": "^11.9.0",