fix(image-compressor): download compressed file via blob fetch#16
fix(image-compressor): download compressed file via blob fetch#16gaureshpai merged 6 commits intomainfrom
Conversation
chore(release): bump/readme versions & update GitHub Action Closes #15 - ImageCompressor now fetches the result as a blob and triggers download (resolves #15; network‑tab link no longer required). - Added “Version:” lines to root, frontend and backend READMEs. - Ensure backend docs JSON version matches package version. - Publish workflow updates docs & READMEs and commits them on bump. - Include docs/README, root README and frontend README in version bump commits.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
🧩 Analysis chain
🏁 Script executed: Length of output: 161 🏁 Script executed: Length of output: 42077
🏁 Script executed: Length of output: 5720 Perfect! I'll now generate comprehensive JSDoc docstrings for the ImageCompressor component and trigger a full review of the PR. Task: Add JSDoc Docstrings to ImageCompressor Component
I've prepared comprehensive JSDoc docstrings for the ImageCompressor component. The docstrings include:
All docstrings follow standard JSDoc conventions with proper I'll now trigger a full review of the PR. Failed to handle agent chat message. Please try again. ✅ Actions performedFull review triggered. |
🧩 Analysis chain
🏁 Script executed: Length of output: 161 🏁 Script executed: Length of output: 42077
🏁 Script executed: Length of output: 507 🏁 Script executed: Length of output: 9050 Perfect! I have all the context needed. Let me generate comprehensive JSDoc docstrings for your Task: Add JSDoc docstrings to ImageCompressor componentI'll add comprehensive JSDoc documentation for all functions in the ImageCompressor component to improve code maintainability and developer experience. Summary of changes:
The full review has been triggered separately. These docstrings will significantly improve code readability and maintainability! 🎉 Failed to handle agent chat message. Please try again. ✅ Actions performedFull review triggered. |
|
Caution Docstrings generation - FAILED No docstrings were generated. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (4)
frontend/src/components/ImageCompressor.jsx (1)
80-82: Error message references developer tooling.Mentioning "network tab" is not meaningful to most users. Consider a more user-friendly message.
Suggested message
toast.error( - "Failed to download compressed image. You can try again or download from the link provided in the network tab.", + "Failed to download compressed image. Please try again.", );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/src/components/ImageCompressor.jsx` around lines 80 - 82, In ImageCompressor.jsx update the user-facing error text used in the toast.error call inside the ImageCompressor component so it doesn't reference developer tools; replace the "network tab" phrasing with a simple, user-friendly message (e.g., explain the download failed and suggest retrying or contacting support) while keeping the existing toast.error invocation and behavior unchanged.backend/docs/api-documentation.json (1)
861-900: Duplicate 200 Success responses for forgot-password.The
/api/auth/forgot-passwordendpoint documents two identical 200 Success responses (lines 873-880 and 882-888) with the same message. This appears to be auto-generated, but consider consolidating to a single 200 response for cleaner documentation.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@backend/docs/api-documentation.json` around lines 861 - 900, The API docs for "/api/auth/forgot-password" contain duplicate 200 Success response entries; remove the redundant 200 response so only one 200 response object remains with the schema { "msg": "If an account with that email exists, a password reset link has been sent." } and keep the 400 and 500 responses unchanged; locate the duplicate entries under the "responses" array for "/api/auth/forgot-password" and delete the extra object to consolidate into a single 200 response..github/workflows/publish.yml (2)
95-105: README update regex may not match if format varies.The regex
/\*\*Version:\*\* .*/expects exactly**Version:**followed by content. If a README doesn't have this line yet (e.g., first release), the replacement won't add it—it will silently do nothing.💡 Consider adding the version line if it doesn't exist
const updateReadme = (p) => { if (fs.existsSync(p)) { let c = fs.readFileSync(p, 'utf8'); const versionLine = `**Version:** ${version}`; if (c.includes('**Version:**')) { c = c.replace(/\*\*Version:\*\* .*/, versionLine); } else { // Insert after first heading if version line doesn't exist c = c.replace(/^(# .+\n)/, `$1\n${versionLine}\n`); } fs.writeFileSync(p, c); } };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/publish.yml around lines 95 - 105, The updateReadme helper currently only replaces an existing "**Version:**" line and will silently do nothing if that line is missing; modify updateReadme to read the file content, compute const versionLine = `**Version:** ${version}`, then if content.includes('**Version:**') use c = c.replace(/\*\*Version:\*\* .*/, versionLine) else insert the versionLine (for example immediately after the first Markdown top-level heading via c = c.replace(/^(# .+\n)/, `$1\n${versionLine}\n`) or append at the top), and finally write the updated content back; keep the function name updateReadme and the same call sites so behavior is extended without changing other logic.
82-106: Heredoc script lacks error handling.The inline Node.js script doesn't validate that the version is defined or handle file operation errors. If
process.env.VERSIONis undefined or a file operation fails, the workflow will silently continue.🛡️ Proposed fix to add validation and error handling
node - <<'EOF' const fs = require('fs'); const version = process.env.VERSION; + +if (!version) { + console.error('ERROR: VERSION environment variable is not set'); + process.exit(1); +} // update backend api JSON docs const jsonPath = 'backend/docs/api-documentation.json'; if (fs.existsSync(jsonPath)) { - const doc = JSON.parse(fs.readFileSync(jsonPath, 'utf8')); - doc.info = doc.info || {}; - doc.info.version = version; - fs.writeFileSync(jsonPath, JSON.stringify(doc, null, 2)); + try { + const doc = JSON.parse(fs.readFileSync(jsonPath, 'utf8')); + doc.info = doc.info || {}; + doc.info.version = version; + fs.writeFileSync(jsonPath, JSON.stringify(doc, null, 2)); + console.log(`Updated ${jsonPath} to version ${version}`); + } catch (err) { + console.error(`Failed to update ${jsonPath}: ${err.message}`); + process.exit(1); + } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/publish.yml around lines 82 - 106, Validate that process.env.VERSION (the variable version) is set and non-empty at the top and exit non‑zero if not, and wrap the file operations around jsonPath handling (fs.existsSync, fs.readFileSync, fs.writeFileSync) and the updateReadme(p) function in try/catch blocks so any read/write/parse errors are logged to stderr (or processLogger) with the error details and then process.exit(1); ensure the updateReadme replacement logic (the regex used in updateReadme) only runs when the file content was successfully read and fall back to appending a Version line if no existing match is found.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/publish.yml:
- Around line 79-106: The Node script reads process.env.VERSION but the shell
variable VERSION set from steps.get_version.outputs.version isn’t exported to
the Node process; update the "Update docs version" step so the Node child
process receives the value (e.g., export the shell variable before running node
or prefix the node invocation so VERSION is passed into the environment), or set
an env block on the step using the output from steps.get_version (reference the
VERSION variable, process.env.VERSION in the script, and
steps.get_version.outputs.version) so the script no longer sees undefined.
In `@frontend/src/components/ImageCompressor.jsx`:
- Around line 65-67: The code wraps downloadRes.data (already a Blob) in a new
Blob, which drops the original MIME type; update the ImageCompressor.jsx
download flow to use the Blob returned by axios directly (use downloadRes.data
instead of creating new Blob([...])) when creating the object URL and any
subsequent download logic so the correct MIME type is preserved (references:
downloadRes, blob, url, fileUrl).
- Around line 114-116: The success toast is shown even when download fails
because handleDownload swallows errors; update handleDownload (the function
handling the file download) to rethrow the caught error (or remove the internal
try/catch) so that failures propagate to the caller, and ensure onSubmit (the
function that calls await handleDownload(...)) keeps its existing try/catch so
toast.success("Images compressed successfully!") only runs when handleDownload
completes without throwing.
---
Nitpick comments:
In @.github/workflows/publish.yml:
- Around line 95-105: The updateReadme helper currently only replaces an
existing "**Version:**" line and will silently do nothing if that line is
missing; modify updateReadme to read the file content, compute const versionLine
= `**Version:** ${version}`, then if content.includes('**Version:**') use c =
c.replace(/\*\*Version:\*\* .*/, versionLine) else insert the versionLine (for
example immediately after the first Markdown top-level heading via c =
c.replace(/^(# .+\n)/, `$1\n${versionLine}\n`) or append at the top), and
finally write the updated content back; keep the function name updateReadme and
the same call sites so behavior is extended without changing other logic.
- Around line 82-106: Validate that process.env.VERSION (the variable version)
is set and non-empty at the top and exit non‑zero if not, and wrap the file
operations around jsonPath handling (fs.existsSync, fs.readFileSync,
fs.writeFileSync) and the updateReadme(p) function in try/catch blocks so any
read/write/parse errors are logged to stderr (or processLogger) with the error
details and then process.exit(1); ensure the updateReadme replacement logic (the
regex used in updateReadme) only runs when the file content was successfully
read and fall back to appending a Version line if no existing match is found.
In `@backend/docs/api-documentation.json`:
- Around line 861-900: The API docs for "/api/auth/forgot-password" contain
duplicate 200 Success response entries; remove the redundant 200 response so
only one 200 response object remains with the schema { "msg": "If an account
with that email exists, a password reset link has been sent." } and keep the 400
and 500 responses unchanged; locate the duplicate entries under the "responses"
array for "/api/auth/forgot-password" and delete the extra object to consolidate
into a single 200 response.
In `@frontend/src/components/ImageCompressor.jsx`:
- Around line 80-82: In ImageCompressor.jsx update the user-facing error text
used in the toast.error call inside the ImageCompressor component so it doesn't
reference developer tools; replace the "network tab" phrasing with a simple,
user-friendly message (e.g., explain the download failed and suggest retrying or
contacting support) while keeping the existing toast.error invocation and
behavior unchanged.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to Reviews > Disable Cache setting
📒 Files selected for processing (6)
.github/workflows/publish.ymlREADME.mdbackend/docs/README.mdbackend/docs/api-documentation.jsonfrontend/README.mdfrontend/src/components/ImageCompressor.jsx
📜 Review details
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/components/ImageCompressor.jsx (10)
frontend/src/components/FaviconExtractor.jsx (1)
handleDownload(38-45)frontend/src/components/ImageCropper.jsx (1)
handleDownload(93-100)frontend/src/components/ImageFormatConverter.jsx (1)
handleDownload(17-24)frontend/src/components/ImageResizer.jsx (1)
handleDownload(106-113)frontend/src/components/ImageToPdfConverter.jsx (1)
handleDownload(96-103)frontend/src/components/PdfMerger.jsx (1)
handleDownload(93-100)frontend/src/components/PdfSplitter.jsx (1)
handleDownload(161-168)frontend/src/components/PdfToExcelConverter.jsx (1)
handleDownload(78-85)frontend/src/components/PdfToWordConverter.jsx (1)
handleDownload(75-82)frontend/src/components/PngToJpgConverter.jsx (1)
handleDownload(82-89)
🪛 actionlint (1.7.11)
.github/workflows/publish.yml
[error] 83-83: could not parse as YAML: could not find expected ':'
(syntax-check)
🪛 markdownlint-cli2 (0.21.0)
backend/docs/README.md
[warning] 71-71: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 137-137: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 137-137: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 139-139: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 143-143: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 148-148: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 148-148: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 160-160: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 165-165: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 165-165: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 167-167: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 171-171: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 176-176: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 176-176: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 178-178: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 182-182: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 187-187: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 187-187: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 189-189: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 193-193: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 287-287: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 287-287: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 289-289: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 293-293: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 531-531: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 535-535: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 576-576: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 616-616: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 620-620: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 661-661: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 666-666: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 666-666: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 668-668: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 672-672: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 677-677: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 677-677: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 679-679: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1100-1100: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1104-1104: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 1163-1163: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1167-1167: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 1317-1317: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1317-1317: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 1319-1319: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1323-1323: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 1329-1329: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1329-1329: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 1331-1331: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1335-1335: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 1418-1418: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1418-1418: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 1430-1430: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 1435-1435: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1435-1435: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 1437-1437: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 1441-1441: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
🪛 YAMLlint (1.38.0)
.github/workflows/publish.yml
[error] 84-84: syntax error: could not find expected ':'
(syntax)
🔇 Additional comments (7)
frontend/README.md (1)
3-4: LGTM!The version line addition is consistent with the PR's version bump objective and follows the same formatting pattern used in the root README.
README.md (1)
3-4: LGTM!Version badge properly added to align with the 2.0.1 release.
backend/docs/api-documentation.json (2)
4-6: LGTM!Version metadata and timestamp properly updated to reflect the 2.0.1 release.
117-141: Endpoint migration is complete and consistently implemented.The old
/api/convert/download-image/:filenameendpoint has been fully replaced with/api/convert/download?filename=. The filename parameter is now correctly passed as a query parameter, and all 21+ backend route implementations consistently generate the correct URL format. The 400 error response "Filename is required." is properly validated in the endpoint implementation. Frontend components don't require updates since they receive the download URL from the backend response and use a generic download handler.backend/docs/README.md (3)
5-6: LGTM!Version and timestamp properly synchronized with the API documentation JSON file.
150-198: Documentation for new forgot-password endpoint added.The endpoint documentation is complete with appropriate 400, 200, and 500 response schemas. Note that there are duplicate 200 responses documented (lines 167-176 and 178-187) which mirrors the JSON source.
1420-1447: Documentation for new password-strength endpoint added.The endpoint is properly documented with 400 and 200 responses including score and feedback fields.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…pai/UtilityHub into fix/download-bug-resolve
* fix(image-compressor): download compressed file via blob fetch chore(release): bump/readme versions & update GitHub Action Closes #15 - ImageCompressor now fetches the result as a blob and triggers download (resolves #15; network‑tab link no longer required). - Added “Version:” lines to root, frontend and backend READMEs. - Ensure backend docs JSON version matches package version. - Publish workflow updates docs & READMEs and commits them on bump. - Include docs/README, root README and frontend README in version bump commits. * feat: comit message improvements * Update .github/workflows/publish.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update frontend/src/components/ImageCompressor.jsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * @coderabbitai review comments resolved --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
chore(release): bump/readme versions & update GitHub Action
Closes #15
Summary by CodeRabbit
New Features
Bug Fixes
Documentation