fix: use jsdelivr's content-type header to detect binary file#2036
fix: use jsdelivr's content-type header to detect binary file#2036
content-type header to detect binary file#2036Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
46a7626 to
d3cfce5
Compare
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
contentType key to /api/registry/file/... responsecontent-type header to detect binary file
content-type header to detect binary filecontent-type header to detect binary file
📝 WalkthroughWalkthroughRefactors binary-file detection from path-extension based logic to MIME type-based checks by replacing Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
🔗 Linked issue
resolve #2034
🧭 Context
#1959 introduced a new feature to detect the binary file to prevent showing binary content in the text content viewer. But the current detection method is only checking the filename, resulting in the possible false positive detection.
This switches the logic to use the
content-typeheader from the upstream CDN response.📚 Description
content-typeheader value from CDN.content-type. For example,image/*will be estimated as a binary file, instead of checking if the file path ends with.png,.jpg, etc.Example: