Add deprecation flag on the directory, don't remove it entirely

This commit is contained in:
Dane Everitt 2021-08-02 20:15:25 -07:00
parent a33ac304ca
commit ec57f43dd4

View File

@ -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"`
// 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 {