Description
When uploading documents via the user upload feature (with USE_USER_UPLOAD=true and AZURE_ENFORCE_ACCESS_CONTROL=true), the sourcefile field in the Azure AI Search index gets a "- " prefix that shouldn't be there.
Steps to Reproduce
- Enable user upload and access control:
azd env set USE_USER_UPLOAD true
azd env set AZURE_ENFORCE_ACCESS_CONTROL true
azd provision && azd deploy
- Log in and upload a document (e.g.,
PyCon US 2025.pdf)
- Query the search index to inspect the indexed document
Expected Behavior
The sourcefile field should match the original filename:
sourcefile: "PyCon US 2025.pdf"
Actual Behavior
The sourcefile field has a "- " prefix:
sourcefile: "- PyCon US 2025.pdf"
Impact
This causes the /content/<path> route to return 403 Forbidden when trying to view the document, because check_path_auth() filters by sourcefile eq 'PyCon US 2025.pdf' but the indexed value is '- PyCon US 2025.pdf'.
Environment
- User upload enabled with ADLS Gen2
- Access control enforcement enabled
- Local development (may also affect deployed environments)
Description
When uploading documents via the user upload feature (with
USE_USER_UPLOAD=trueandAZURE_ENFORCE_ACCESS_CONTROL=true), thesourcefilefield in the Azure AI Search index gets a"- "prefix that shouldn't be there.Steps to Reproduce
PyCon US 2025.pdf)Expected Behavior
The
sourcefilefield should match the original filename:Actual Behavior
The
sourcefilefield has a"- "prefix:Impact
This causes the
/content/<path>route to return 403 Forbidden when trying to view the document, becausecheck_path_auth()filters bysourcefile eq 'PyCon US 2025.pdf'but the indexed value is'- PyCon US 2025.pdf'.Environment