Azure / Azure/azure-functions-host

Functions treat an encoded forward slash as a separate route

Open
#5,619 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

Please provide the following:

- Function App version (1.0 or 2.0): 2.0
- Invocation ID: Can't get one as this issue causes the route to not resolve to a function
- Region:

#### Repro steps

Provide the steps required to reproduce the problem:

Create a function with a route similar to:

Route = "foo/{section}/{userId}/"

Section is a string which can contain forward slashes (/). For example, `bar/sub-bar`. We encode this in the web request so it becomes `bar%2Fsub-bar`

An example query would be:

`foo/bar%2Fsub-bar/1`

This however returns a 404 as it treats it as `foo/bar/sub-bar/1` (i.e. a different route path).

A request without the encoding / hits the endpoint successfully, however:

`foo/barsub-bar/1`

#### Expected behavior

It shouldn't decode the forward slash when resolving the function for a route.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with a Function App 2.0 route using `foo/{section}/{userId}/` and a request such as `foo/bar%2Fsub-bar/1`. Trace how the host resolves the encoded route segment; done means the encoded slash remains within `section` and the request resolves instead of returning 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend-api-design, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.