Skip to content

should lowercase ext when looking up in staticmimetypemap#2468

Merged
sawka merged 1 commit intomainfrom
sawka/lookup-ext-case-insensitive
Oct 21, 2025
Merged

should lowercase ext when looking up in staticmimetypemap#2468
sawka merged 1 commit intomainfrom
sawka/lookup-ext-case-insensitive

Conversation

@sawka
Copy link
Member

@sawka sawka commented Oct 21, 2025

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

The changes modify the DetectMimeType and DetectMimeTypeWithDirEnt functions in pkg/util/fileutil/fileutil.go to convert file extensions to lowercase before performing lookups in StaticMimeTypeMap. This ensures case-insensitive MIME type matching regardless of whether the file extension uses uppercase or lowercase characters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

The change applies a consistent, straightforward transformation (strings.ToLower()) across two functions. The modification is minor and follows a single pattern. Review focus should verify that StaticMimeTypeMap keys are stored in lowercase to ensure the case-insensitive matching functions correctly, and confirm no edge cases are introduced by this normalization.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "should lowercase ext when looking up in staticmimetypemap" directly and accurately reflects the main change described in the AI-generated summary. The change is specifically about converting the file extension to lowercase before looking it up in StaticMimeTypeMap, and the title captures this core functionality precisely. The title is concise, clear, and specific enough that a teammate reviewing the history would immediately understand the primary change being made.
Description Check ✅ Passed No pull request description was provided by the author. The check criteria state that this is a very lenient check that should pass as long as the description is not completely off-topic or misleading. An empty description is neither off-topic nor misleading—it simply lacks detail. While a description would be helpful for context, its absence does not violate the lenient nature of this check, which prioritizes avoiding actively problematic descriptions over requiring comprehensive explanations.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sawka/lookup-ext-case-insensitive

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7131ca4 and 0c63bf1.

📒 Files selected for processing (1)
  • pkg/util/fileutil/fileutil.go (2 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: Build for TestDriver.ai
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
pkg/util/fileutil/fileutil.go (2)

90-90: LGTM! Case-insensitive extension matching implemented correctly.

The lowercase conversion ensures consistent MIME type detection regardless of extension casing. This also benefits the mime.TypeByExtension call on line 94, which conventionally expects lowercase extensions.


139-139: LGTM! Consistent case-insensitive implementation.

The change is consistent with the modification in DetectMimeType and correctly enables case-insensitive MIME type detection.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

Error: unknown linters: 'unusedfunc,unusedparams', run 'golangci-lint help linters' to see the list of supported linters
The command is terminated due to an error: unknown linters: 'unusedfunc,unusedparams', run 'golangci-lint help linters' to see the list of supported linters


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sawka sawka merged commit 271c355 into main Oct 21, 2025
8 checks passed
@sawka sawka deleted the sawka/lookup-ext-case-insensitive branch October 21, 2025 17:06
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.

1 participant