Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static middleware doesn't work on Windows #91

Open
iamxeph opened this issue Apr 1, 2016 · 2 comments
Open

static middleware doesn't work on Windows #91

iamxeph opened this issue Apr 1, 2016 · 2 comments

Comments

@iamxeph
Copy link

iamxeph commented Apr 1, 2016

static middleware uses os.Stat which is not for Windows.

stats, err := os.Stat(name)

@DeadNumbers
Copy link

DeadNumbers commented Apr 23, 2017

Also

package main

import (
	"os"

	"github.com/gin-gonic/contrib/static"
	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()
	r.Use(static.Serve("/", static.LocalFile(os.Getenv("HOME"), true)))
	r.GET("/ping", func(c *gin.Context) {
		c.String(200, "test")
	})
	r.Run(":8080")
}

Return 404 page not found. But it works in Linux.

@GwynethLlewelyn
Copy link

I have no Windows machine to try this out; however, by looking at the Go source code, os.Stat() was patched a few times during 2016/2017 in order to provide better support under Windows and make it 'more compatible' with the routines calling os.Stat(). As such, this ought to be working fine (in 2023!). Can someone confirm that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants