Skip to content

Commit

Permalink
fixed a bug where the filter will be lost if the file within a subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
bodaay committed Oct 12, 2024
1 parent 421b1e4 commit 2f14ce8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.8
1.3.9
9 changes: 7 additions & 2 deletions hfdownloader/hfdownloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func processHFFolderTree(ModelPath string, IsDataset bool, SkipSHA bool, ModelDa
AgreementURL := fmt.Sprintf(AgreementModelURL, ModelDatasetName)
HasFilter := false
var FilterBinFileString []string
originalDataSetName := ModelDatasetName // fix a bug where filters will be skipped when we call the function recursiley
if strings.Contains(ModelDatasetName, ":") && !IsDataset {
HasFilter = true
// remove the filtered content from Model Name
Expand Down Expand Up @@ -175,7 +176,9 @@ func processHFFolderTree(ModelPath string, IsDataset bool, SkipSHA bool, ModelDa
if err := os.MkdirAll(filePath, os.ModePerm); err != nil {
return err
}
if err := processHFFolderTree(ModelPath, IsDataset, SkipSHA, ModelDatasetName, Branch, file.Path, silentMode); err != nil {
//here we should pass the original name with filters, other wise the filter will be applied

if err := processHFFolderTree(ModelPath, IsDataset, SkipSHA, originalDataSetName, Branch, file.Path, silentMode); err != nil {
return err
}
} else {
Expand Down Expand Up @@ -256,7 +259,9 @@ func processHFFolderTree(ModelPath string, IsDataset bool, SkipSHA bool, ModelDa
}
jsonFilesList[i].SkipDownloading = true
// now if this a folder, this whole function will be called again recursively
err = processHFFolderTree(ModelPath, IsDataset, SkipSHA, ModelDatasetName, Branch, jsonFilesList[i].Path, silentMode) // recursive call
//here we should pass the original name with filters, other wise the filter will be applied

err = processHFFolderTree(ModelPath, IsDataset, SkipSHA, originalDataSetName, Branch, jsonFilesList[i].Path, silentMode) // recursive call
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/spf13/cobra"
)

const VERSION = "1.3.8"
const VERSION = "1.3.9"

type Config struct {
NumConnections int `json:"num_connections"`
Expand Down

0 comments on commit 2f14ce8

Please sign in to comment.