-
Notifications
You must be signed in to change notification settings - Fork 615
fix: fix for ingest non-English file names and URLs #2025
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
base: dev
Are you sure you want to change the base?
fix: fix for ingest non-English file names and URLs #2025
Conversation
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Roopan-Microsoft <[email protected]> Co-authored-by: Ajit Padhi <[email protected]> Co-authored-by: Roopan P M <[email protected]> Co-authored-by: Pavan-Microsoft <[email protected]> Co-authored-by: Ross Smith <[email protected]> Co-authored-by: gpickett <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Harmanpreet-Microsoft <[email protected]> Co-authored-by: UtkarshMishra-Microsoft <[email protected]> Co-authored-by: Priyanka-Microsoft <[email protected]> Co-authored-by: Prasanjeet-Microsoft <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <[email protected]> Co-authored-by: Prashant-Microsoft <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]> Co-authored-by: Avijit-Microsoft <[email protected]> Co-authored-by: RaviKiran-Microsoft <[email protected]> Co-authored-by: Somesh Joshi <[email protected]> Co-authored-by: Himanshi Agrawal <[email protected]> Co-authored-by: pradeepjha-microsoft <[email protected]> Co-authored-by: Harmanpreet Kaur <[email protected]> Co-authored-by: Bangarraju-Microsoft <[email protected]> Co-authored-by: Harsh-Microsoft <[email protected]> Co-authored-by: Kanchan-Microsoft <[email protected]> Co-authored-by: Cristopher Coronado <[email protected]> Co-authored-by: Cristopher Coronado Moreira <[email protected]> Co-authored-by: Vamshi-Microsoft <[email protected]> Co-authored-by: Thanusree-Microsoft <[email protected]> Co-authored-by: Niraj Chaudhari (Persistent Systems Inc) <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]> Co-authored-by: Kingshuk-Microsoft <[email protected]> Co-authored-by: Ayaz-Microsoft <[email protected]> Co-authored-by: Abdul-Microsoft <[email protected]> Co-authored-by: Prekshith-Microsoft <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Roopan-Microsoft <[email protected]> Co-authored-by: Ajit Padhi <[email protected]> Co-authored-by: Roopan P M <[email protected]> Co-authored-by: Pavan-Microsoft <[email protected]> Co-authored-by: Ross Smith <[email protected]> Co-authored-by: gpickett <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Prajwal D C <[email protected]> Co-authored-by: Harmanpreet-Microsoft <[email protected]> Co-authored-by: UtkarshMishra-Microsoft <[email protected]> Co-authored-by: Priyanka-Microsoft <[email protected]> Co-authored-by: Prasanjeet-Microsoft <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <[email protected]> Co-authored-by: Prashant-Microsoft <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]> Co-authored-by: Avijit-Microsoft <[email protected]> Co-authored-by: RaviKiran-Microsoft <[email protected]> Co-authored-by: Somesh Joshi <[email protected]> Co-authored-by: Himanshi Agrawal <[email protected]> Co-authored-by: pradeepjha-microsoft <[email protected]> Co-authored-by: Harmanpreet Kaur <[email protected]> Co-authored-by: Bangarraju-Microsoft <[email protected]> Co-authored-by: Harsh-Microsoft <[email protected]> Co-authored-by: Kanchan-Microsoft <[email protected]> Co-authored-by: Cristopher Coronado <[email protected]> Co-authored-by: Cristopher Coronado Moreira <[email protected]> Co-authored-by: Vamshi-Microsoft <[email protected]> Co-authored-by: Thanusree-Microsoft <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]> Co-authored-by: Kingshuk-Microsoft <[email protected]> Co-authored-by: Ayaz-Microsoft <[email protected]> Co-authored-by: Abdul-Microsoft <[email protected]> Co-authored-by: Prekshith-Microsoft <[email protected]>
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 introduces encoding and decoding of non-ASCII characters in filenames and URLs to support non-English content (e.g., Hebrew characters) throughout the application. The changes aim to ensure that filenames are properly encoded when stored in blob storage and metadata, and decoded when displayed in the UI.
Changes:
- Added URL encoding using
urllib.parse.quotefor filenames and URLs before storage in blob storage and metadata - Added URL decoding using
urllib.parse.unquotefor filenames when displaying them in UI (Explore Data and Delete Data pages) - Added User-Agent header to HTTP requests in URL ingestion to avoid being blocked by websites
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
| code/backend/batch/add_url_embeddings.py | Added URL encoding for blob names and metadata, plus User-Agent header for HTTP requests |
| code/backend/pages/01_Ingest_Data.py | Added URL encoding for metadata title, commented out previous sanitization function |
| code/backend/pages/02_Explore_Data.py | Added filename decoding for display in file selection dropdown with encoded-to-decoded mapping |
| code/backend/pages/03_Delete_Data.py | Added filename decoding for checkboxes and success messages after deletion |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Purpose
This pull request introduces improvements to how filenames and URLs are handled throughout the backend, focusing on consistent encoding and decoding of non-ASCII characters (such as those in Hebrew) to ensure compatibility and better user experience. The main changes involve encoding filenames and URLs before storage or upload, and decoding them for display in the UI, as well as adding user-agent headers to HTTP requests for better compatibility with external sites.
Filenames and URLs encoding/decoding improvements:
urllib.parse.quotebefore being uploaded to blob storage or used as metadata, ensuring non-ASCII characters are handled correctly and URL structure is preserved (add_url_embeddings.py,01_Ingest_Data.py). [1] [2]urllib.parse.unquoteso users see readable names instead of encoded strings (02_Explore_Data.py,03_Delete_Data.py). [1] [2]03_Delete_Data.py).HTTP request improvements:
download_url_and_upload_to_blobto avoid being blocked by certain websites (e.g., Wikipedia), and ensured URLs are encoded before making the request.Imports and code hygiene:
urllib.parsein affected files to support encoding/decoding operations. [1] [2] [3]Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
upload file or url with name in non-english