Skip to content

Commit f890b64

Browse files
committed
Update until v2.49.0
1 parent 9c96c69 commit f890b64

45 files changed

Lines changed: 389 additions & 307 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ version: "2"
22

33
linters:
44
default: standard
5+
enable:
6+
- gocritic
7+
- govet
8+
- revive
59
exclusions:
610
presets:
711
- std-error-handling
12+
- comments
813
paths:
914
- frontend/

cmd/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var docsCmd = &cobra.Command{
3535

3636
rootCmd.Root().DisableAutoGenTag = true
3737

38-
err = doc.GenMarkdownTreeCustom(cmd.Root(), tempDir, func(f string) string {
38+
err = doc.GenMarkdownTreeCustom(cmd.Root(), tempDir, func(_ string) string {
3939
return ""
4040
}, func(s string) string {
4141
return s

cmd/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var (
5454
)
5555

5656
// TODO(remove): remove after July 2026.
57-
func migrateFlagNames(f *pflag.FlagSet, name string) pflag.NormalizedName {
57+
func migrateFlagNames(_ *pflag.FlagSet, name string) pflag.NormalizedName {
5858
if newName, ok := flagNamesMigrations[name]; ok {
5959

6060
if !warnedFlags[name] {
@@ -146,7 +146,7 @@ The precedence of the configuration values are as follows:
146146
Also, if the database path doesn't exist, File Browser will enter into
147147
the quick setup mode and a new database will be bootstrapped and a new
148148
user created with the credentials from options "username" and "password".`,
149-
RunE: withViperAndStore(func(cmd *cobra.Command, _ []string, v *viper.Viper, st *store) error {
149+
RunE: withViperAndStore(func(_ *cobra.Command, _ []string, v *viper.Viper, st *store) error {
150150
if !st.databaseExisted {
151151
err := quickSetup(v, st.Storage)
152152
if err != nil {

cmd/utils.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,14 @@ func withViperAndStore(fn func(cmd *cobra.Command, args []string, v *viper.Viper
160160
}
161161

162162
exists, err := dbExists(path)
163-
if err != nil {
163+
switch {
164+
case err != nil:
164165
return err
165-
} else if exists && options.expectsNoDatabase {
166+
case exists && options.expectsNoDatabase:
166167
log.Fatal(path + " already exists")
167-
} else if !exists && !options.expectsNoDatabase && !options.allowsNoDatabase {
168+
case !exists && !options.expectsNoDatabase && !options.allowsNoDatabase:
168169
log.Fatal(path + " does not exist. Please run 'filebrowser config init' first.")
169-
} else if !exists && !options.expectsNoDatabase {
170+
case !exists && !options.expectsNoDatabase:
170171
log.Println("WARNING: filebrowser.db can't be found. Initialing in " + strings.TrimSuffix(path, "filebrowser.db"))
171172
}
172173

@@ -193,7 +194,7 @@ func withViperAndStore(fn func(cmd *cobra.Command, args []string, v *viper.Viper
193194
}
194195

195196
func withStore(fn func(cmd *cobra.Command, args []string, store *store) error, options storeOptions) cobraFunc {
196-
return withViperAndStore(func(cmd *cobra.Command, args []string, v *viper.Viper, store *store) error {
197+
return withViperAndStore(func(cmd *cobra.Command, args []string, _ *viper.Viper, store *store) error {
197198
return fn(cmd, args, store)
198199
}, options)
199200
}

diskcache/file_cache_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ func TestFileCache(t *testing.T) {
2525
// store new key
2626
err := cache.Store(ctx, key, []byte(value))
2727
require.NoError(t, err)
28-
checkValue(t, ctx, fs, filepath.Join(cacheRoot, cachedFilePath), cache, key, value)
28+
checkValue(ctx, t, fs, filepath.Join(cacheRoot, cachedFilePath), cache, key, value)
2929

3030
// update existing key
3131
err = cache.Store(ctx, key, []byte(newValue))
3232
require.NoError(t, err)
33-
checkValue(t, ctx, fs, filepath.Join(cacheRoot, cachedFilePath), cache, key, newValue)
33+
checkValue(ctx, t, fs, filepath.Join(cacheRoot, cachedFilePath), cache, key, newValue)
3434

3535
// delete key
3636
err = cache.Delete(ctx, key)
@@ -40,7 +40,7 @@ func TestFileCache(t *testing.T) {
4040
require.False(t, exists)
4141
}
4242

43-
func checkValue(t *testing.T, ctx context.Context, fs afero.Fs, fileFullPath string, cache *FileCache, key, wantValue string) {
43+
func checkValue(ctx context.Context, t *testing.T, fs afero.Fs, fileFullPath string, cache *FileCache, key, wantValue string) {
4444
t.Helper()
4545
// check actual file content
4646
b, err := afero.ReadFile(fs, fileFullPath)

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@
7171
"vite-plugin-compression2": "^2.3.1",
7272
"vue-tsc": "^3.1.3"
7373
},
74-
"packageManager": "pnpm@10.22.0+sha512.bf049efe995b28f527fd2b41ae0474ce29186f7edcb3bf545087bd61fbbebb2bf75362d1307fda09c2d288e1e499787ac12d4fcb617a974718a6051f2eee741c"
74+
"packageManager": "pnpm@10.23.0+sha512.21c4e5698002ade97e4efe8b8b4a89a8de3c85a37919f957e7a0f30f38fbc5bbdd05980ffe29179b2fb6e6e691242e098d945d1601772cad0fef5fb6411e2a4b"
7575
}

0 commit comments

Comments
 (0)