From bbb8d2fe6ea7eccb87b03644cfdae7e5d7e89346 Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Sat, 10 Sep 2022 20:31:46 +0200 Subject: [PATCH] fix(actions): cross platform watch dir file handling (#458) * chore: update deps * fix(actions): cross-platform file handling * fix(qbittorrent): unrelated failing test --- go.mod | 76 +++++++++++++++++-------------- go.sum | 36 +++++++-------- internal/action/deluge.go | 6 +-- internal/action/exec.go | 4 +- internal/action/rtorrent.go | 4 +- internal/action/run.go | 17 +++---- internal/filter/service.go | 6 +-- internal/notification/discord.go | 4 +- internal/notification/telegram.go | 4 +- pkg/btn/btn_test.go | 11 +++-- pkg/ggn/ggn.go | 4 +- pkg/ggn/ggn_test.go | 6 +-- pkg/lidarr/lidarr_test.go | 6 +-- pkg/ptp/ptp.go | 4 +- pkg/ptp/ptp_test.go | 4 +- pkg/qbittorrent/domain_test.go | 2 + pkg/qbittorrent/methods.go | 26 +++++------ pkg/radarr/radarr_test.go | 11 +++-- pkg/red/red.go | 4 +- pkg/red/red_test.go | 6 +-- pkg/sonarr/sonarr_test.go | 5 +- pkg/torznab/torznab_test.go | 6 +-- 22 files changed, 129 insertions(+), 123 deletions(-) diff --git a/go.mod b/go.mod index 8da3667..e583e8c 100644 --- a/go.mod +++ b/go.mod @@ -2,90 +2,97 @@ module github.com/autobrr/autobrr go 1.18 +require ( + github.com/Masterminds/sprig/v3 v3.2.2 + github.com/Masterminds/squirrel v1.5.3 + github.com/anacrolix/torrent v1.46.0 + github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef + github.com/avast/retry-go v3.0.0+incompatible + github.com/dcarbone/zadapters/zstdlog v0.3.1 + github.com/dustin/go-humanize v1.0.0 + github.com/ergochat/irc-go v0.2.0 + github.com/fsnotify/fsnotify v1.5.4 + github.com/gdm85/go-libdeluge v0.5.6 + github.com/go-chi/chi/v5 v5.0.7 + github.com/go-chi/render v1.0.2 + github.com/gorilla/sessions v1.2.1 + github.com/gosimple/slug v1.12.0 + github.com/hashicorp/go-version v1.6.0 + github.com/hekmon/transmissionrpc/v2 v2.0.1 + github.com/lib/pq v1.10.7 + github.com/mattn/go-shellwords v1.0.12 + github.com/mmcdole/gofeed v1.1.3 + github.com/moistari/rls v0.3.0 + github.com/mrobinsn/go-rtorrent v1.8.0 + github.com/pkg/errors v0.9.1 + github.com/r3labs/sse/v2 v2.8.1 + github.com/robfig/cron/v3 v3.0.1 + github.com/rs/cors v1.8.2 + github.com/rs/zerolog v1.28.0 + github.com/sasha-s/go-deadlock v0.3.1 + github.com/spf13/pflag v1.0.5 + github.com/spf13/viper v1.13.0 + github.com/stretchr/testify v1.8.0 + golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 + golang.org/x/net v0.0.0-20220909164309-bea034e7d591 + golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 + gopkg.in/natefinch/lumberjack.v2 v2.0.0 + gopkg.in/yaml.v3 v3.0.1 + modernc.org/sqlite v1.18.2 +) + require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect - github.com/Masterminds/sprig/v3 v3.2.2 // indirect - github.com/Masterminds/squirrel v1.5.3 // indirect github.com/PuerkitoBio/goquery v1.5.1 // indirect github.com/ajg/form v1.5.1 // indirect github.com/anacrolix/missinggo v1.3.0 // indirect github.com/anacrolix/missinggo/v2 v2.7.0 // indirect - github.com/anacrolix/torrent v1.46.0 // indirect github.com/andybalholm/cascadia v1.1.0 // indirect - github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect - github.com/avast/retry-go v3.0.0+incompatible // indirect github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect - github.com/dcarbone/zadapters/zstdlog v0.3.1 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect - github.com/ergochat/irc-go v0.2.0 // indirect - github.com/fsnotify/fsnotify v1.5.4 // indirect - github.com/gdm85/go-libdeluge v0.5.6 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/gdm85/go-rencode v0.1.8 // indirect - github.com/go-chi/chi/v5 v5.0.7 // indirect - github.com/go-chi/render v1.0.2 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/securecookie v1.1.1 // indirect - github.com/gorilla/sessions v1.2.1 // indirect - github.com/gosimple/slug v1.12.0 // indirect github.com/gosimple/unidecode v1.0.1 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hekmon/cunits/v2 v2.1.0 // indirect - github.com/hekmon/transmissionrpc/v2 v2.0.1 // indirect github.com/huandu/xstrings v1.3.2 // indirect github.com/imdario/mergo v0.3.11 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect - github.com/lib/pq v1.10.7 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.16 // indirect - github.com/mattn/go-shellwords v1.0.12 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.0 // indirect - github.com/mmcdole/gofeed v1.1.3 // indirect github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/moistari/rls v0.3.0 // indirect - github.com/mrobinsn/go-rtorrent v1.8.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/r3labs/sse/v2 v2.8.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect - github.com/robfig/cron/v3 v3.0.1 // indirect - github.com/rs/cors v1.8.2 // indirect - github.com/rs/zerolog v1.28.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shopspring/decimal v1.2.0 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.13.0 // indirect github.com/subosito/gotenv v1.4.1 // indirect - golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect golang.org/x/mod v0.4.1 // indirect - golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect - golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect golang.org/x/tools v0.1.0 // indirect golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/uint128 v1.1.1 // indirect modernc.org/cc/v3 v3.37.0 // indirect modernc.org/ccgo/v3 v3.16.9 // indirect @@ -93,7 +100,6 @@ require ( modernc.org/mathutil v1.5.0 // indirect modernc.org/memory v1.3.0 // indirect modernc.org/opt v0.1.1 // indirect - modernc.org/sqlite v1.18.2 // indirect modernc.org/strutil v1.1.3 // indirect modernc.org/token v1.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9b0cdbf..895798b 100644 --- a/go.sum +++ b/go.sum @@ -38,6 +38,7 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797/go.mod h1:sXBiorCo8c46JlQV3oXPKINnZ8mcqnye1EkVkqsectk= crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +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/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= @@ -61,6 +62,7 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/anacrolix/dht/v2 v2.16.2-0.20220311024416-dd658f18fd51 h1:issCwqC43gQ7n0gg9rn0EeVYXnQMI7vlnWub4oidtlU= github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c= github.com/anacrolix/envpprof v1.0.0/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c= github.com/anacrolix/envpprof v1.1.0/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4= @@ -110,7 +112,9 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cytec/releaseparser v0.0.0-20200706155913-2341b265c370 h1:g9q5BGfDdhcXn4EmVZD8UydPXrvhSvgz3FRBn7zAJNs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dcarbone/zadapters/zstdlog v0.3.1 h1:BB2brDbBxH+/Dec96EI3Mb9/LC0aFcnDJm9bVqiJRv0= github.com/dcarbone/zadapters/zstdlog v0.3.1/go.mod h1:/eRABVjBs/8NYkN8LLRkBuQJVc6PFVxdec3WbvgIzoc= @@ -129,6 +133,7 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ergochat/irc-go v0.2.0 h1:3vHdy4c56UTY6+/rTBrQc1fmt32N5G8PrEZacJDOr+E= github.com/ergochat/irc-go v0.2.0/go.mod h1:2vi7KNpIPWnReB5hmLpl92eMywQvuIeIIGdt/FQCph0= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= @@ -197,6 +202,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -212,7 +218,6 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -249,7 +254,6 @@ github.com/hekmon/transmissionrpc/v2 v2.0.1/go.mod h1:+s96Pkg7dIP3h2PT3fzhXPvNb3 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= -github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -259,7 +263,6 @@ github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -275,8 +278,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= @@ -288,12 +293,12 @@ github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPK github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk= github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= +github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= @@ -309,7 +314,6 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= @@ -337,6 +341,7 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= @@ -363,11 +368,11 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qq github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.20.0 h1:38k9hgtUBdxFwE34yS8rTHmHBa4eN16E4DJlv177LNs= github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo= github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= @@ -387,7 +392,6 @@ github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:X github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff/go.mod h1:KSQcGKpxUMHk3nbYzs/tIBAM2iDooCn0BmttHOJEbLs= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= -github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= @@ -407,6 +411,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= @@ -434,15 +439,10 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 h1:bXoxMPcSLOq08zI3/c5dEBT6lE4eh+jOh886GHrn6V8= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE= -golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -516,9 +516,6 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI= golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -587,11 +584,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -762,6 +755,7 @@ gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -795,7 +789,9 @@ modernc.org/cc/v3 v3.37.0 h1:Y9XYwAPXYZUL1h5vvYPJDlvx7XEVBZdDcdodqax8t7c= modernc.org/cc/v3 v3.37.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= modernc.org/ccgo/v3 v3.16.9 h1:AXquSwg7GuMk11pIdw7fmO1Y/ybgazVkMhsZWCV0mHM= modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= +modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= +modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0= modernc.org/libc v1.18.0 h1:EKpC8eyhOcxpstYjohs7vxni7BoQBUVWXsf5rAZzlgk= @@ -814,9 +810,11 @@ modernc.org/sqlite v1.18.2/go.mod h1:kvrTLEWgxUcHa2GfHBQtanR1H9ht3hTJNtKpzH9k1u0 modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= +modernc.org/tcl v1.13.2 h1:5PQgL/29XkQ9wsEmmNPjzKs+7iPCaYqUJAhzPvQbjDA= modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg= modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +modernc.org/z v1.5.1 h1:RTNHdsrOpeoSeOF4FbzTo8gBYByaJ5xT7NgZ9ZqRiJM= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/internal/action/deluge.go b/internal/action/deluge.go index d3fc569..0ce2d37 100644 --- a/internal/action/deluge.go +++ b/internal/action/deluge.go @@ -3,7 +3,7 @@ package action import ( "context" "encoding/base64" - "io/ioutil" + "os" "time" "github.com/autobrr/autobrr/internal/domain" @@ -123,7 +123,7 @@ func (s *service) delugeV1(client *domain.DownloadClient, action domain.Action, } } - t, err := ioutil.ReadFile(release.TorrentTmpFile) + t, err := os.ReadFile(release.TorrentTmpFile) if err != nil { return nil, errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile) } @@ -212,7 +212,7 @@ func (s *service) delugeV2(client *domain.DownloadClient, action domain.Action, } } - t, err := ioutil.ReadFile(release.TorrentTmpFile) + t, err := os.ReadFile(release.TorrentTmpFile) if err != nil { return nil, errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile) } diff --git a/internal/action/exec.go b/internal/action/exec.go index 038ccc7..71f73be 100644 --- a/internal/action/exec.go +++ b/internal/action/exec.go @@ -1,7 +1,7 @@ package action import ( - "io/ioutil" + "os" "os/exec" "strings" "time" @@ -23,7 +23,7 @@ func (s *service) execCmd(action domain.Action, release domain.Release) error { // read the file into bytes we can then use in the macro if len(release.TorrentDataRawBytes) == 0 && release.TorrentTmpFile != "" { - t, err := ioutil.ReadFile(release.TorrentTmpFile) + t, err := os.ReadFile(release.TorrentTmpFile) if err != nil { return errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile) } diff --git a/internal/action/rtorrent.go b/internal/action/rtorrent.go index 45e274d..cacc1c4 100644 --- a/internal/action/rtorrent.go +++ b/internal/action/rtorrent.go @@ -2,7 +2,7 @@ package action import ( "context" - "io/ioutil" + "os" "github.com/autobrr/autobrr/internal/domain" "github.com/autobrr/autobrr/pkg/errors" @@ -38,7 +38,7 @@ func (s *service) rtorrent(action domain.Action, release domain.Release) ([]stri // create client rt := rtorrent.New(client.Host, true) - tmpFile, err := ioutil.ReadFile(release.TorrentTmpFile) + tmpFile, err := os.ReadFile(release.TorrentTmpFile) if err != nil { return nil, errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile) } diff --git a/internal/action/run.go b/internal/action/run.go index 9e049ab..a376ecd 100644 --- a/internal/action/run.go +++ b/internal/action/run.go @@ -4,10 +4,9 @@ import ( "bytes" "crypto/tls" "io" - "io/ioutil" "net/http" "os" - "path" + "path/filepath" "strings" "time" @@ -141,7 +140,7 @@ func (s *service) watchFolder(action domain.Action, release domain.Release) erro } if len(release.TorrentDataRawBytes) == 0 { - t, err := ioutil.ReadFile(release.TorrentTmpFile) + t, err := os.ReadFile(release.TorrentTmpFile) if err != nil { return errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile) } @@ -166,12 +165,11 @@ func (s *service) watchFolder(action domain.Action, release domain.Release) erro } defer original.Close() - _, tmpFileName := path.Split(release.TorrentTmpFile) - fullFileName := path.Join(watchFolderArgs, tmpFileName+".torrent") + _, tmpFileName := filepath.Split(release.TorrentTmpFile) + fullFileName := filepath.Join(watchFolderArgs, tmpFileName+".torrent") // Create folder - err = os.MkdirAll(watchFolderArgs, os.ModePerm) - if err != nil { + if err = os.MkdirAll(watchFolderArgs, os.ModePerm); err != nil { return errors.Wrap(err, "could not create new folders %v", fullFileName) } @@ -183,8 +181,7 @@ func (s *service) watchFolder(action domain.Action, release domain.Release) erro defer newFile.Close() // Copy file - _, err = io.Copy(newFile, original) - if err != nil { + if _, err := io.Copy(newFile, original); err != nil { return errors.Wrap(err, "could not copy file %v to watch folder", fullFileName) } @@ -203,7 +200,7 @@ func (s *service) webhook(action domain.Action, release domain.Release) error { // if webhook data contains TorrentDataRawBytes, lets read the file into bytes we can then use in the macro if len(release.TorrentDataRawBytes) == 0 && strings.Contains(action.WebhookData, "TorrentDataRawBytes") { - t, err := ioutil.ReadFile(release.TorrentTmpFile) + t, err := os.ReadFile(release.TorrentTmpFile) if err != nil { return errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile) } diff --git a/internal/filter/service.go b/internal/filter/service.go index e8144af..afa445f 100644 --- a/internal/filter/service.go +++ b/internal/filter/service.go @@ -5,8 +5,8 @@ import ( "context" "crypto/tls" "fmt" - "io/ioutil" "net/http" + "os" "os/exec" "strings" "time" @@ -450,7 +450,7 @@ func (s *service) execCmd(release *domain.Release, cmd string, args string) (int // read the file into bytes we can then use in the macro if len(release.TorrentDataRawBytes) == 0 && release.TorrentTmpFile != "" { - t, err := ioutil.ReadFile(release.TorrentTmpFile) + t, err := os.ReadFile(release.TorrentTmpFile) if err != nil { return 0, errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile) } @@ -510,7 +510,7 @@ func (s *service) webhook(release *domain.Release, url string, data string) (int // if webhook data contains TorrentDataRawBytes, lets read the file into bytes we can then use in the macro if len(release.TorrentDataRawBytes) == 0 && strings.Contains(data, "TorrentDataRawBytes") { - t, err := ioutil.ReadFile(release.TorrentTmpFile) + t, err := os.ReadFile(release.TorrentTmpFile) if err != nil { return 0, errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile) } diff --git a/internal/notification/discord.go b/internal/notification/discord.go index f27f29a..627915b 100644 --- a/internal/notification/discord.go +++ b/internal/notification/discord.go @@ -5,7 +5,7 @@ import ( "crypto/tls" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "strings" "time" @@ -89,7 +89,7 @@ func (a *discordSender) Send(event domain.NotificationEvent, payload domain.Noti return errors.Wrap(err, "could not make request: %+v", req) } - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { a.log.Error().Err(err).Msgf("discord client request error: %v", event) return errors.Wrap(err, "could not read data") diff --git a/internal/notification/telegram.go b/internal/notification/telegram.go index 567800d..fae1834 100644 --- a/internal/notification/telegram.go +++ b/internal/notification/telegram.go @@ -6,7 +6,7 @@ import ( "encoding/json" "fmt" "html" - "io/ioutil" + "io" "net/http" "strings" "time" @@ -73,7 +73,7 @@ func (s *telegramSender) Send(event domain.NotificationEvent, payload domain.Not return errors.Wrap(err, "could not make request: %+v", req) } - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { s.log.Error().Err(err).Msgf("telegram client request error: %v", event) return errors.Wrap(err, "could not read data") diff --git a/pkg/btn/btn_test.go b/pkg/btn/btn_test.go index e28a1a0..62f2ffe 100644 --- a/pkg/btn/btn_test.go +++ b/pkg/btn/btn_test.go @@ -1,9 +1,10 @@ package btn import ( - "io/ioutil" + "io" "net/http" "net/http/httptest" + "os" "strings" "testing" @@ -34,7 +35,7 @@ func TestAPI(t *testing.T) { //} // read json response - jsonPayload, _ := ioutil.ReadFile("testdata/btn_get_user_info.json") + jsonPayload, _ := os.ReadFile("testdata/btn_get_user_info.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) @@ -90,7 +91,7 @@ func TestClient_GetTorrentByID(t *testing.T) { } defer r.Body.Close() - data, err := ioutil.ReadAll(r.Body) + data, err := io.ReadAll(r.Body) if err != nil { t.Errorf("expected error to be nil got %v", err) } @@ -105,7 +106,7 @@ func TestClient_GetTorrentByID(t *testing.T) { } if !strings.Contains(string(data), key) { - jsonPayload, _ := ioutil.ReadFile("testdata/btn_bad_creds.json") + jsonPayload, _ := os.ReadFile("testdata/btn_bad_creds.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusUnauthorized) w.Write(jsonPayload) @@ -113,7 +114,7 @@ func TestClient_GetTorrentByID(t *testing.T) { } // read json response - jsonPayload, _ := ioutil.ReadFile("testdata/btn_get_torrent_by_id.json") + jsonPayload, _ := os.ReadFile("testdata/btn_get_torrent_by_id.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) diff --git a/pkg/ggn/ggn.go b/pkg/ggn/ggn.go index 0b17579..128e9e2 100644 --- a/pkg/ggn/ggn.go +++ b/pkg/ggn/ggn.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "strconv" @@ -203,7 +203,7 @@ func (c *client) GetTorrentByID(torrentID string) (*domain.TorrentBasic, error) defer resp.Body.Close() - body, readErr := ioutil.ReadAll(resp.Body) + body, readErr := io.ReadAll(resp.Body) if readErr != nil { return nil, errors.Wrap(readErr, "error reading body") } diff --git a/pkg/ggn/ggn_test.go b/pkg/ggn/ggn_test.go index 08ca45e..5873ebc 100644 --- a/pkg/ggn/ggn_test.go +++ b/pkg/ggn/ggn_test.go @@ -1,9 +1,9 @@ package ggn import ( - "io/ioutil" "net/http" "net/http/httptest" + "os" "strings" "testing" @@ -29,7 +29,7 @@ func Test_client_GetTorrentByID(t *testing.T) { } if !strings.Contains(r.RequestURI, "422368") { - jsonPayload, _ := ioutil.ReadFile("testdata/ggn_get_torrent_by_id_not_found.json") + jsonPayload, _ := os.ReadFile("testdata/ggn_get_torrent_by_id_not_found.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) @@ -37,7 +37,7 @@ func Test_client_GetTorrentByID(t *testing.T) { } // read json response - jsonPayload, _ := ioutil.ReadFile("testdata/ggn_get_torrent_by_id.json") + jsonPayload, _ := os.ReadFile("testdata/ggn_get_torrent_by_id.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) diff --git a/pkg/lidarr/lidarr_test.go b/pkg/lidarr/lidarr_test.go index 22daa39..840b06d 100644 --- a/pkg/lidarr/lidarr_test.go +++ b/pkg/lidarr/lidarr_test.go @@ -1,9 +1,9 @@ package lidarr import ( - "io/ioutil" "net/http" "net/http/httptest" + "os" "testing" "github.com/rs/zerolog" @@ -32,7 +32,7 @@ func Test_client_Push(t *testing.T) { } // read json response - jsonPayload, _ := ioutil.ReadFile("testdata/release_push_response.json") + jsonPayload, _ := os.ReadFile("testdata/release_push_response.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) @@ -125,7 +125,7 @@ func Test_client_Test(t *testing.T) { return } } - jsonPayload, _ := ioutil.ReadFile("testdata/system_status_response.json") + jsonPayload, _ := os.ReadFile("testdata/system_status_response.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) diff --git a/pkg/ptp/ptp.go b/pkg/ptp/ptp.go index 5655fec..d8bf170 100644 --- a/pkg/ptp/ptp.go +++ b/pkg/ptp/ptp.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "time" @@ -142,7 +142,7 @@ func (c *Client) GetTorrentByID(torrentID string) (*domain.TorrentBasic, error) defer resp.Body.Close() - body, readErr := ioutil.ReadAll(resp.Body) + body, readErr := io.ReadAll(resp.Body) if readErr != nil { return nil, errors.Wrap(readErr, "could not read body") } diff --git a/pkg/ptp/ptp_test.go b/pkg/ptp/ptp_test.go index 927660f..ff0a105 100644 --- a/pkg/ptp/ptp_test.go +++ b/pkg/ptp/ptp_test.go @@ -1,9 +1,9 @@ package ptp import ( - "io/ioutil" "net/http" "net/http/httptest" + "os" "testing" "github.com/autobrr/autobrr/internal/domain" @@ -36,7 +36,7 @@ func TestPTPClient_GetTorrentByID(t *testing.T) { } // read json response - jsonPayload, _ := ioutil.ReadFile("testdata/ptp_get_torrent_by_id.json") + jsonPayload, _ := os.ReadFile("testdata/ptp_get_torrent_by_id.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) diff --git a/pkg/qbittorrent/domain_test.go b/pkg/qbittorrent/domain_test.go index e6f42fd..e9ffc2b 100644 --- a/pkg/qbittorrent/domain_test.go +++ b/pkg/qbittorrent/domain_test.go @@ -88,6 +88,7 @@ func TestTorrentAddOptions_Prepare(t *testing.T) { want: map[string]string{ "skip_checking": "true", "root_folder": "true", + "contentLayout": "Subfolder", "autoTMM": "false", "ratioLimit": "2.00", "savepath": "/home/test/torrents", @@ -116,6 +117,7 @@ func TestTorrentAddOptions_Prepare(t *testing.T) { want: map[string]string{ "skip_checking": "true", "root_folder": "false", + "contentLayout": "NoSubfolder", "autoTMM": "false", "ratioLimit": "2.00", "savepath": "/home/test/torrents", diff --git a/pkg/qbittorrent/methods.go b/pkg/qbittorrent/methods.go index 7dd4ef3..6309730 100644 --- a/pkg/qbittorrent/methods.go +++ b/pkg/qbittorrent/methods.go @@ -2,7 +2,7 @@ package qbittorrent import ( "encoding/json" - "io/ioutil" + "io" "net/http" "net/http/httputil" "strconv" @@ -30,7 +30,7 @@ func (c *Client) Login() error { defer resp.Body.Close() - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) if err != nil { return err } @@ -64,7 +64,7 @@ func (c *Client) GetTorrents() ([]Torrent, error) { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read body") } @@ -89,7 +89,7 @@ func (c *Client) GetTorrentsFilter(filter TorrentFilter) ([]Torrent, error) { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read body") } @@ -116,7 +116,7 @@ func (c *Client) GetTorrentsActiveDownloads() ([]Torrent, error) { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read body") } @@ -146,7 +146,7 @@ func (c *Client) GetTorrentsRaw() (string, error) { defer resp.Body.Close() - data, err := ioutil.ReadAll(resp.Body) + data, err := io.ReadAll(resp.Body) if err != nil { return "", errors.Wrap(err, "could not get read body torrents raw") } @@ -180,7 +180,7 @@ func (c *Client) GetTorrentTrackers(hash string) ([]TorrentTracker, error) { return nil, nil } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read body") } @@ -258,7 +258,7 @@ func (c *Client) GetTransferInfo() (*TransferInfo, error) { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read body") } @@ -295,7 +295,7 @@ func (c *Client) SetForceStart(hashes []string, value bool) error { hv := strings.Join(hashes, "|") opts := map[string]string{ "hashes": hv, - "value": strconv.FormatBool(value), + "value": strconv.FormatBool(value), } resp, err := c.get("torrents/setForceStart", opts) @@ -400,7 +400,7 @@ func (c *Client) EditCategory(category string, path string) error { return nil } -func (c *Client) RemoveCategories(categories[] string) error { +func (c *Client) RemoveCategories(categories []string) error { opts := map[string]string{ "categories": strings.Join(categories, "\n"), } @@ -420,7 +420,7 @@ func (c *Client) SetCategory(hashes []string, category string) error { // Add hashes together with | separator hv := strings.Join(hashes, "|") opts := map[string]string{ - "hashes": hv, + "hashes": hv, "category": category, } @@ -447,7 +447,7 @@ func (c *Client) GetFilesInformation(hash string) (*TorrentFiles, error) { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read body") } @@ -468,7 +468,7 @@ func (c *Client) GetCategories() (map[string]Category, error) { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read body") } diff --git a/pkg/radarr/radarr_test.go b/pkg/radarr/radarr_test.go index 239b30d..8ff3656 100644 --- a/pkg/radarr/radarr_test.go +++ b/pkg/radarr/radarr_test.go @@ -1,9 +1,10 @@ package radarr import ( - "io/ioutil" + "io" "net/http" "net/http/httptest" + "os" "strings" "testing" @@ -34,13 +35,13 @@ func Test_client_Push(t *testing.T) { } defer r.Body.Close() - data, err := ioutil.ReadAll(r.Body) + data, err := io.ReadAll(r.Body) if err != nil { t.Errorf("expected error to be nil got %v", err) } if strings.Contains(string(data), "Minx 1 epi 9 2160p") { - jsonPayload, _ := ioutil.ReadFile("testdata/release_push_parse_error.json") + jsonPayload, _ := os.ReadFile("testdata/release_push_parse_error.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusBadRequest) w.Write(jsonPayload) @@ -48,7 +49,7 @@ func Test_client_Push(t *testing.T) { } // read json response - jsonPayload, _ := ioutil.ReadFile("testdata/release_push_response.json") + jsonPayload, _ := os.ReadFile("testdata/release_push_response.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) @@ -164,7 +165,7 @@ func Test_client_Test(t *testing.T) { return } } - jsonPayload, _ := ioutil.ReadFile("testdata/system_status_response.json") + jsonPayload, _ := os.ReadFile("testdata/system_status_response.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) diff --git a/pkg/red/red.go b/pkg/red/red.go index d541668..88544d9 100644 --- a/pkg/red/red.go +++ b/pkg/red/red.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "strconv" @@ -174,7 +174,7 @@ func (c *Client) GetTorrentByID(torrentID string) (*domain.TorrentBasic, error) defer resp.Body.Close() - body, readErr := ioutil.ReadAll(resp.Body) + body, readErr := io.ReadAll(resp.Body) if readErr != nil { return nil, errors.Wrap(readErr, "could not read body") } diff --git a/pkg/red/red_test.go b/pkg/red/red_test.go index e9945f9..1b39186 100644 --- a/pkg/red/red_test.go +++ b/pkg/red/red_test.go @@ -1,9 +1,9 @@ package red import ( - "io/ioutil" "net/http" "net/http/httptest" + "os" "strings" "testing" @@ -28,7 +28,7 @@ func TestREDClient_GetTorrentByID(t *testing.T) { } if !strings.Contains(r.RequestURI, "29991962") { - jsonPayload, _ := ioutil.ReadFile("testdata/get_torrent_by_id_not_found.json") + jsonPayload, _ := os.ReadFile("testdata/get_torrent_by_id_not_found.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusBadRequest) w.Write(jsonPayload) @@ -36,7 +36,7 @@ func TestREDClient_GetTorrentByID(t *testing.T) { } // read json response - jsonPayload, _ := ioutil.ReadFile("testdata/get_torrent_by_id.json") + jsonPayload, _ := os.ReadFile("testdata/get_torrent_by_id.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) diff --git a/pkg/sonarr/sonarr_test.go b/pkg/sonarr/sonarr_test.go index f2083da..5c24d4d 100644 --- a/pkg/sonarr/sonarr_test.go +++ b/pkg/sonarr/sonarr_test.go @@ -5,6 +5,7 @@ import ( "log" "net/http" "net/http/httptest" + "os" "testing" "github.com/stretchr/testify/assert" @@ -35,7 +36,7 @@ func Test_client_Push(t *testing.T) { } // read json response - jsonPayload, _ := ioutil.ReadFile("testdata/release_push_response.json") + jsonPayload, _ := os.ReadFile("testdata/release_push_response.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) @@ -133,7 +134,7 @@ func Test_client_Test(t *testing.T) { return } } - jsonPayload, _ := ioutil.ReadFile("testdata/system_status_response.json") + jsonPayload, _ := os.ReadFile("testdata/system_status_response.json") w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(jsonPayload) diff --git a/pkg/torznab/torznab_test.go b/pkg/torznab/torznab_test.go index 7867cdc..2975b6f 100644 --- a/pkg/torznab/torznab_test.go +++ b/pkg/torznab/torznab_test.go @@ -2,9 +2,9 @@ package torznab import ( "encoding/xml" - "io/ioutil" "net/http" "net/http/httptest" + "os" "strings" "testing" @@ -23,7 +23,7 @@ import ( // return // } // } -// payload, err := ioutil.ReadFile("testdata/torznab_response.xml") +// payload, err := os.ReadFile("testdata/torznab_response.xml") // if err != nil { // http.Error(w, err.Error(), http.StatusInternalServerError) // return @@ -85,7 +85,7 @@ func TestClient_GetCaps(t *testing.T) { return } - payload, err := ioutil.ReadFile("testdata/caps_response.xml") + payload, err := os.ReadFile("testdata/caps_response.xml") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return