[Fixes 13919] Fix UTF-8 handling for GeoJSON uploads with non-ASCII properties#13916
[Fixes 13919] Fix UTF-8 handling for GeoJSON uploads with non-ASCII properties#13916mattiagiupponi merged 1 commit intoGeoNode:masterfrom
Conversation
Ensure GeoJSON files containing non-ASCII (e.g. Chinese) attribute values are correctly detected and validated by explicitly decoding input as UTF-8 in GeoJsonFileHandler. This prevents false negatives in handler detection and avoids incorrectly reporting valid GeoJSON files as invalid due to implicit or system-dependent encoding assumptions.
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @F0rtiter on file. In order for us to review and merge your code, please contact the project maintainers to get yourself added. |
Summary of ChangesHello @F0rtiter, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical encoding issue that previously caused GeoJSON files with non-ASCII characters in their properties to be misidentified or fail validation. By explicitly enforcing UTF-8 decoding during file reading and content processing, the system can now accurately handle and validate such GeoJSON data, ensuring seamless integration and preventing false negatives for valid files. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses UTF-8 handling for GeoJSON file uploads by explicitly specifying encoding="utf-8" when reading files. This change aligns with the GeoJSON specification (RFC 7946), which mandates UTF-8 encoding, and improves the robustness of file processing by preventing errors with non-ASCII characters. The modifications in can_handle and is_valid methods are consistent and well-implemented, ensuring that GeoJSON files are correctly detected and validated regardless of system default encodings. The changes are a solid improvement to the GeoJSON handler.
|
Hi @F0rtiter thanks for the contribution, as soon as the Test suite pass i'll test the PR. Thanks! |
|
I've opened an issue describing the use case: #13919 |
) Ensure GeoJSON files containing non-ASCII (e.g. Chinese) attribute values are correctly detected and validated by explicitly decoding input as UTF-8 in GeoJsonFileHandler. This prevents false negatives in handler detection and avoids incorrectly reporting valid GeoJSON files as invalid due to implicit or system-dependent encoding assumptions. (cherry picked from commit d93a30d)
) (#13941) Ensure GeoJSON files containing non-ASCII (e.g. Chinese) attribute values are correctly detected and validated by explicitly decoding input as UTF-8 in GeoJsonFileHandler. This prevents false negatives in handler detection and avoids incorrectly reporting valid GeoJSON files as invalid due to implicit or system-dependent encoding assumptions. (cherry picked from commit d93a30d) Co-authored-by: F0rtiter <40894236+F0rtiter@users.noreply.github.com>
Ensure GeoJSON files containing non-ASCII (e.g. Chinese) attribute values
are correctly detected and validated by explicitly decoding input as UTF-8
in GeoJsonFileHandler.
This prevents false negatives in handler detection and avoids incorrectly
reporting valid GeoJSON files as invalid due to implicit or system-dependent
encoding assumptions.