marshmallow-code / marshmallow-code/marshmallow

fields.Url ValidationError parsing internationalized domain name

Open
#1,422 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
738
Avg merge
1d 23h
Merged PRs (30d)
7

Description

Description

The perfectly valid urls in the test case below are resolved correctly by most contemporary browsers (and – curiously – wget, but not curl), but do not pass marshmallows Url field validation. Which i think they should, because they do show up in real world data.

I'm not sure how to best approach the problem.

Test Case

"""Tests for marshmallow.validate"""
import pytest

from marshmallow import validate


@pytest.mark.parametrize(
    "valid_url",
    [
        "http://www.kunstkontor-nürnberg.de",
        "http://💩.la",
    ],
)
def test_url_absolute_valid(valid_url):
    validator = validate.URL(relative=False)
    assert validator(valid_url) == valid_url

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied parametrized test with validate.URL(relative=False), then trace the URL validation entry point to see how the two internationalized domain names are handled. Done means both examples are accepted and returned unchanged, with the regression covered by the test case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.