Skip to content

HandleDir redirects the files [BUG] #1672

Description

@sajadko

Describe the bug
When I use "HandleDir" function to set a folder static, the function properly shows and list files and folders (showlist true). but when I click to file like this: "http://localhost:8000/public/assets/css/style.css", it redirects to "http://localhost:8000/public/assets/css/".
Turning on or off "Show list " doesn't affect the problem.

package main

import "github.com/kataras/iris/v12"

func main() {
	app := iris.New()
	
	index := func(ctx iris.Context) {
		ctx.StatusCode(200)
		ctx.JSON(iris.Map{"message": "This is a message"})
	}
	app.Get("/", index)
	app.HandleDir("/public", iris.Dir("./public/"), iris.DirOptions{ShowList: true})
	app.Listen(":8000")
}

Screenshots
Folder Structure :
image

Desktop (please complete the following information):

  • OS: Windows 10

iris.Version
github.com/kataras/iris/v12@master (v12.2.0)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions