-
Notifications
You must be signed in to change notification settings - Fork 2
FIX: Add quotes to curl download command #939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe update revises the construction of a curl command string in the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Assessment against linked issues
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/app/item-page/clarin-files-section/clarin-files-section.component.ts (1)
102-108:fileNamesis computed but never used
ThefileNamesarray is built solely to setcanShowCurlDownload, then discarded. This is dead code that adds an unnecessary loop every time the command is generated.- const fileNames = this.listOfFiles.value.map((file: MetadataBitstream) => { + // No need to build an intermediate array; early-exit once we know at least one file is previewable + this.canShowCurlDownload = this.listOfFiles.value.some( + (file: MetadataBitstream) => file.canPreview + ); - if (file.canPreview) { - this.canShowCurlDownload = true; - } - - return file.name; - });This eliminates the unused variable and reduces the per-call complexity from O(n) to O(n) with an early exit.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/app/item-page/clarin-files-section/clarin-files-section.component.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: dspace-angular / docker-build (linux/amd64, ubuntu-latest, true)
- GitHub Check: tests (16.x)
- GitHub Check: tests (18.x)
🔇 Additional comments (1)
src/app/item-page/clarin-files-section/clarin-files-section.component.ts (1)
110-110: Quotes correctly added – nice fix 👍
Wrapping both the output filename and the URL in double quotes resolves the copy-&-paste issue in POSIX shells.
src/app/item-page/clarin-files-section/clarin-files-section.component.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes a formatting issue in the generated curl command by adding proper quoting around the filename and URL. This ensures the command works correctly when copied to command-line environments, especially when URLs or filenames contain special characters or spaces.
- Added double quotes around the output filename "allzip.zip"
- Added double quotes around the full URL
- Refactored the string concatenation to use template literals for improved readability
This pull request addresses the issue where the generated
curlcommand for downloading files was missing quotes around the filename and the URL. This could cause issues when pasting the command into a command-line environment.The fix was applied in the
generateCurlCommand()method within theclarin-files-section.component.tsfile. The string concatenation was modified to wrap both the output filename (allzip.zip) and the full URL in double quotes (").Closes #933
Summary by CodeRabbit