fix(api): support emoji and punycode domains in analysis tasks#150
Merged
Conversation
WebPage validation stores URLs as Unicode, which breaks requests for emoji domains like xn--3s8h30f.ws. Use AnyHttpUrl for punycode conversion and pass the encoded URL to the worker queue. Fixes cnumr/EcoIndex#416 Co-authored-by: Cursor <cursoragent@cursor.com>
Branch coverage •
|
||||||||||||||||||||
Expose SSL, timeout, and DNS errors in the unreachable URL response instead of empty parentheses. Co-authored-by: Cursor <cursoragent@cursor.com>
vvatelot
added a commit
that referenced
this pull request
Jul 15, 2026
* fix(api): support emoji and punycode domains in analysis tasks WebPage validation stores URLs as Unicode, which breaks requests for emoji domains like xn--3s8h30f.ws. Use AnyHttpUrl for punycode conversion and pass the encoded URL to the worker queue. Fixes cnumr/EcoIndex#416 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(api): include request error details when URL pre-check fails Expose SSL, timeout, and DNS errors in the unreachable URL response instead of empty parentheses. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
vvatelot
added a commit
that referenced
this pull request
Jul 15, 2026
* feat(api): allow choosing MySQL or PostgreSQL via DB_ENGINE Developers can now pick sqlite, mysql, or postgres at startup through a single DB_ENGINE setting, with Docker Compose profiles and local dev containers aligned on the same configuration. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(api): support emoji and punycode domains in analysis tasks (#150) * fix(api): support emoji and punycode domains in analysis tasks WebPage validation stores URLs as Unicode, which breaks requests for emoji domains like xn--3s8h30f.ws. Use AnyHttpUrl for punycode conversion and pass the encoded URL to the worker queue. Fixes cnumr/EcoIndex#416 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(api): include request error details when URL pre-check fails Expose SSL, timeout, and DNS errors in the unreachable URL response instead of empty parentheses. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> * fix(api): keep DATABASE_URL typed as str for ty compatibility Use an empty default and resolve it in the model validator so type checkers accept Settings().DATABASE_URL where a str is required. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(api): run alembic migrations from the api project directory Alembic needs projects/ecoindex_api as the working directory so it can find alembic.ini and load the local .env during init-dev-project. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(api): start dev DB before running alembic migrations Ensure mysql/postgres containers are up before migration-upgrade and document which DB_HOST to use for local dev versus Docker Compose. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
https://xn--3s8h30f.ws/) that failed with a 400/500 erroridna.encodeconversion with PydanticAnyHttpUrl, which correctly handles emoji labels that standard IDNA encoding rejectsFixes cnumr/EcoIndex#416
Context
When submitting
https://xn--3s8h30f.ws/, theWebPagevalidator stores the URL as Unicode (https://🦊💻.ws/). The previousconvert_url_to_punycodehelper could not re-encode emoji domains, causingrequests.headto fail withInvalidURL.Test plan
test/bases/ecoindex/backend/test_tasks.py)POST /v1/tasks/ecoindexes/with{"web_page": {"url": "https://xn--3s8h30f.ws/", "width": 1920, "height": 1080}}returns 201Made with Cursor