Skip to content

Commit

Permalink
Fixed route path error
Browse files Browse the repository at this point in the history
Microsoft.AspNetCore.Routing.Patterns.RoutePatternException: A path segment that contains more than one section, such as a literal section or a parameter, cannot contain a catch-all parameter.
  • Loading branch information
themisir committed Jun 18, 2024
1 parent 7b661d8 commit 56932ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Upload.Disk/RouterExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public static IEndpointConventionBuilder MapStaticFiles(this IEndpointRouteBuild
#endif
string routePrefix, string rootDirectory)
{
var pattern = Path.Join(routePrefix, "{**slug}");
var pattern = routePrefix.EndsWith('/')
? routePrefix + "{**slug}"
: routePrefix + "/{**slug}";

var handler = endpoints.CreateApplicationBuilder()
.Use(IgnoreEndpoint)
.UseStaticFiles(new StaticFileOptions
Expand Down

0 comments on commit 56932ac

Please sign in to comment.