Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade files.com SDK #150

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions cmd/files.com-test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ func main() {
if *uploadFile != "" {
filename := filepath.Base(*uploadFile)
fileClient := file.Client{Config: filesConfig}
status, err := fileClient.UploadFile(context.Background(), &file.UploadParams{Source: *uploadFile, Destination: filepath.Join(*path, filename)})
if err != nil {
fmt.Printf("Error uploading file %s: %s", *uploadFile, err)
}
status := fileClient.UploadFile(context.Background(), &file.UploadParams{Source: *uploadFile, Destination: filepath.Join(*path, filename)})
fmt.Println(status.Files())
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/canonical/athena-core
go 1.22

require (
github.com/Files-com/files-sdk-go v1.1.1145
github.com/Files-com/files-sdk-go v1.2.1218
github.com/flosch/pongo2/v4 v4.0.2
github.com/lileio/pubsub/v2 v2.6.1
github.com/makyo/snuffler v0.0.0-20190210075944-33446730a4fe
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Files-com/files-sdk-go v1.1.1145 h1:XmrD0805kGbLIQ0pKpSOZIw7B2a3GV4XHkgDR+HBAIE=
github.com/Files-com/files-sdk-go v1.1.1145/go.mod h1:/qeqiWrGdmRwnHi3ySD9sQ9dgaxBCmvb68a9irT6568=
github.com/Files-com/files-sdk-go v1.2.1218 h1:cPkbrxfplVT5letzggHMCoChNORhG1zCdDLD8euMwrE=
github.com/Files-com/files-sdk-go v1.2.1218/go.mod h1:Fo/MOSJTSB52Bx9GlxeIJCquS4J6WqvTurcLVM8fNWU=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
Expand Down Expand Up @@ -117,7 +117,6 @@ github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0H
github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down
5 changes: 1 addition & 4 deletions pkg/common/files-com.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ func (client *BaseFilesComClient) Upload(contents, destinationPath string) (*fil
return nil, err
}
defer os.Remove(tmpfile.Name())
status, err := client.ApiClient.UploadFile(context.Background(), &file.UploadParams{Source: tmpfile.Name(), Destination: destinationPath})
if err != nil {
return nil, err
}
status := client.ApiClient.UploadFile(context.Background(), &file.UploadParams{Source: tmpfile.Name(), Destination: destinationPath})
return &status.Files()[0], nil
}

Expand Down
Loading