Skip to content

Commit 2cdaca3

Browse files
authored
Merge pull request #628 from ferrohd/fix/remove-api-key-upper-length-limit
fix: remove upper limit on API key length validation
2 parents e45a8e2 + 6041d7e commit 2cdaca3

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/unpackerr/apps.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828
// queue API responses. Both strings must be present so that torrents are
2929
// always processed regardless of which Starr app version is in use.
3030
defaultProtocol = "torrent,TorrentDownloadProtocol"
31-
apiKeyLength = 32
31+
apiKeyMinLength = 32
3232
)
3333

3434
// These are the names used to identify each app.
@@ -39,7 +39,7 @@ const (
3939
// Application validation errors.
4040
var (
4141
ErrInvalidURL = errors.New("provided application URL is invalid")
42-
ErrInvalidKey = fmt.Errorf("provided application API Key is invalid, must be %d characters", apiKeyLength)
42+
ErrInvalidKey = fmt.Errorf("provided application API Key is invalid, must be at least %d characters", apiKeyMinLength)
4343
)
4444

4545
// Config defines the configuration data used to start the application.

pkg/unpackerr/cnfgfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (u *Unpackerr) validateApp(conf *StarrConfig, app starr.App) error {
288288
return fmt.Errorf("%w: (%s) %s", ErrInvalidURL, app, conf.URL)
289289
}
290290

291-
if len(conf.APIKey) != apiKeyLength {
291+
if len(conf.APIKey) < apiKeyMinLength {
292292
return fmt.Errorf("%s (%s) %w, your key length: %d",
293293
app, conf.URL, ErrInvalidKey, len(conf.APIKey))
294294
}

0 commit comments

Comments
 (0)