Skip to content

Fix bugs in Remove Image Object feature - #27

Draft
VisibleNasir with Copilot wants to merge 2 commits into
mainfrom
copilot/remove-image-object
Draft

Fix bugs in Remove Image Object feature#27
VisibleNasir with Copilot wants to merge 2 commits into
mainfrom
copilot/remove-image-object

Conversation

Copilot AI commented Apr 1, 2026

Copy link
Copy Markdown

Three bugs in the "remove object from image" feature: loading state stuck on validation failure, insecure Cloudinary URLs in production, and multer temp files never cleaned up.

Changes

  • RemoveObject.jsx — Early return on multi-word object validation skipped setLoading(false), leaving the button permanently disabled. Moved to a finally block.

  • aiController.jsremoveImageObjectcloudinary.url() emits HTTP by default; added secure: true to avoid mixed-content failures on HTTPS deployments.

  • aiController.jsremoveImageObject + removeImageBackground — Multer temp files were never deleted after upload. Added a deleteTempFile() helper that validates the path is within os.tmpdir() (path-traversal guard) before async deletion.

const deleteTempFile = (filePath) => {
    const resolvedPath = path.resolve(filePath);
    if (resolvedPath.startsWith(path.resolve(os.tmpdir()))) {
        fs.promises.unlink(resolvedPath).catch((err) => console.error("Failed to delete temp file:", err));
    }
};

Copilot AI linked an issue Apr 1, 2026 that may be closed by this pull request
@vercel

vercel Bot commented Apr 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
visible-server Ready Ready Preview, Comment Apr 1, 2026 6:49pm
visiblekai Ready Ready Preview, Comment Apr 1, 2026 6:49pm

Agent-Logs-Url: https://github.com/VisibleNasir/VisibleKAi/sessions/14e40dba-af9f-42a7-8f03-3402f08dc9f2

Co-authored-by: VisibleNasir <109416738+VisibleNasir@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove image object Fix bugs in Remove Image Object feature Apr 1, 2026
Copilot AI requested a review from VisibleNasir April 1, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove image object

2 participants