Skip to content

Commit

Permalink
Fixed URL trailing / double slash bug
Browse files Browse the repository at this point in the history
Ensure no double slash by trimming trailing '/' from srcUrl if present
  • Loading branch information
AMDphreak committed Jan 22, 2025
1 parent fd5b301 commit 4a10098
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Binary file modified bindings/go/examples/go-model-download/go-model-download.exe
Binary file not shown.
7 changes: 5 additions & 2 deletions bindings/go/examples/go-model-download/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,12 @@ func URLForModel(model string) (string, error) {
url, err := url.Parse(srcUrl)
if err != nil {
return "", err
} else {
url.Path = fmt.Sprintf("%s/%s", url.Path, model)
}
// Ensure no double slassh by trimming trailing '/' from srcUrl if present
if url.Path[len(url.Path)-1] == '/' {
url.Path = url.Path[:len(url.Path)-1]
}
url.Path = fmt.Sprintf("%s/%s", url.Path, model)
return url.String(), nil
}

Expand Down

0 comments on commit 4a10098

Please sign in to comment.