Skip to content

Regex artifact in hosts #158

Open
Open
@Amith225

Description

@Amith225

consider the following host:
host(fr'^api', 'api.urls', name='api')

i went through the codebase and found self.compiled_regex = re.compile(r'%s%s(\.|:|$)' % (regex, suffix))
now internally the complied_regex = re.compile('^api(\\.|:|$)')

this creates a problem, if i go to api.localhost this works as expected, but if I go to api.xyz.localhost it still routes me to api.urls

so maybe change the complied_regex to re.compile(r'%s%s(:[0-9]+)?$)' % (regex, suffix)) ?
this will ensure the regex follows parent_host and is either followed by a port with atleast one digit, or no port at all

but this will also force user to give the parent_host, which i think would not be a major problem

if this makes sense, and is ok, i would like to be assigned for this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions