diff --git a/router/router_server_files.go b/router/router_server_files.go index 1b70f89..b8202c3 100644 --- a/router/router_server_files.go +++ b/router/router_server_files.go @@ -254,13 +254,20 @@ func getServerPullingFiles(c *gin.Context) { func postServerPullRemoteFile(c *gin.Context) { s := ExtractServer(c) var data struct { - RootPath string `binding:"required,omitempty" json:"root"` - URL string `binding:"required" json:"url"` + // Deprecated + Directory string `binding:"required_without=RootPath,omitempty" json:"directory"` + RootPath string `binding:"required_without=Directory,omitempty" json:"root"` + URL string `binding:"required" json:"url"` } if err := c.BindJSON(&data); err != nil { return } + // Handle the deprecated Directory field in the struct until it is removed. + if data.Directory != "" && data.RootPath == "" { + data.RootPath = data.Directory + } + u, err := url.Parse(data.URL) if err != nil { if e, ok := err.(*url.Error); ok {