Skip to content

Commit

Permalink
Add deprecation flag on the directory, don't remove it entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed Aug 3, 2021
1 parent a33ac30 commit ec57f43
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions router/router_server_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ec57f43

Please sign in to comment.