Skip to content

Commit 8587ffc

Browse files
Beta/v1.1.4 (#1724)
Co-authored-by: Kevin B. <[email protected]>
1 parent de6fefa commit 8587ffc

Some content is hidden

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

66 files changed

+1081
-430
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
All notable changes to this project will be documented in this file. For commit guidelines, please refer to [Standard Version](https://github.com/conventional-changelog/standard-version).
44

5+
## v1.1.4-beta
6+
7+
**New Features**:
8+
- toggle to show searching results with thumbnails #1545
9+
10+
**Notes**:
11+
- file list has loading spinner to help prevent double click issues and give better feedback
12+
- improved cacheDir startup checks
13+
- warning for slow read/write speeds below 50MB/s
14+
- warning for low free space below 20GB
15+
- warning if read/write latency is slow
16+
- fatal for any errors reading or writing to the directory
17+
- links to official docs for more info
18+
- access rule changes:
19+
- denied folders won't show up in parent directory listing view (#1684)
20+
- tools will respect access rules
21+
- shares will check access rules based on user that created the share
22+
23+
**BugFixes**:
24+
- passwords with special characters not working properly (#1648)
25+
- encoded filename navigation issue (#1711)
26+
- Fix/Improve some behaviors in nextPrevious (#1707)
27+
- Files recognized as folder if they have the same name as previously deleted folders #1697
28+
- multi logger support issue #1701
29+
530
## v1.1.3-beta
631

732
**Notes**:

_docker/Dockerfile.playwright-settings

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ COPY [ "./_docker/src/settings/", "./" ]
77
WORKDIR /app/frontend
88
COPY [ "./_docker/src/settings/frontend/", "./" ]
99
COPY [ "./frontend/tests/", "./tests" ]
10+
COPY [ "./frontend/tests/playwright-files", "/tests/playwright-files" ]
1011

1112
WORKDIR /app/backend/
1213
COPY [ "./backend/filebrowser*", "./"]
@@ -17,4 +18,5 @@ COPY [ "./backend/http/embed/", "./http/dist/"]
1718
# Run tests
1819
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
1920
RUN ./filebrowser set -u testuser1,testuser1
20-
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
21+
RUN ./filebrowser set rule -f /tests/playwright-files -p / -r user -v admin -allow -c config.yaml
22+
RUN ./filebrowser set rule -f /tests/playwright-files -p /excluded -r user -v admin -c config.yaml

_docker/src/settings/backend/config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ server:
1313
config:
1414
disableIndexing: true
1515
defaultEnabled: true
16+
- path: "/tests/playwright-files"
17+
name: "access"
18+
config:
19+
defaultEnabled: true
20+
denyByDefault: true
1621
frontend:
1722
name: "Graham's Filebrowser"
1823
disableDefaultLinks: true

backend/adapters/fs/files/files.go

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ func FileInfoFaster(opts utils.FileOptions, access *access.Storage) (*iteminfo.E
7474
response.RealPath = realPath
7575
response.Source = opts.Source
7676

77-
if access != nil && !access.Permitted(index.Path, opts.Path, opts.Username) {
78-
// User doesn't have access to the current folder, but check if they have access to any subitems
79-
// This allows specific allow rules on subfolders/files to work even when parent is denied
77+
if access != nil {
8078
err := access.CheckChildItemAccess(response, index, opts.Username)
8179
if err != nil {
8280
return response, err
@@ -349,6 +347,10 @@ func DeleteFiles(source, absPath string, absDirPath string, isDir bool) error {
349347
return err
350348
}
351349

350+
// Clear cache entries
351+
indexing.RealPathCache.Delete(absPath)
352+
indexing.IsDirCache.Delete(absPath + ":isdir")
353+
352354
// Remove metadata from index
353355
if isDir {
354356
// Recursively remove directory and all subdirectories from index
@@ -402,6 +404,8 @@ func RefreshIndex(source string, path string, isDir bool, recursive bool) error
402404
if !Exists(realPath) {
403405
// Directory no longer exists, remove it from the index
404406
// This clears both Directories and DirectoriesLedger maps
407+
indexing.RealPathCache.Delete(realPath)
408+
indexing.IsDirCache.Delete(realPath + ":isdir")
405409
idx.DeleteMetadata(path, true, false)
406410
return nil
407411
}
@@ -474,33 +478,23 @@ func MoveResource(isSrcDir bool, sourceIndex, destIndex, realsrc, realdst string
474478

475479
// Handle SOURCE cleanup (treat as deletion)
476480
if !srcIdx.Config.DisableIndexing {
477-
// Remove metadata from source index
478481
if isSrcDir {
479-
// Recursively remove directory and all subdirectories from source index
480482
srcIdx.DeleteMetadata(srcIndexPath, true, true)
481483
} else {
482-
// Remove file from source parent's file list
483484
srcIdx.DeleteMetadata(srcIndexPath, false, false)
484485
}
485-
486-
// Refresh the source parent directory to recalculate sizes and update counts
487486
go RefreshIndex(sourceIndex, srcParentPath, true, false) //nolint:errcheck
488487
}
489488

490489
// Handle DESTINATION indexing
491490
if !dstIdx.Config.DisableIndexing {
492491
if isSrcDir {
493492
go func() {
494-
// When moving a folder, refresh the folder itself recursively FIRST
495-
// Must complete before parent refresh to avoid race condition
496493
RefreshIndex(destIndex, realdst, true, true) //nolint:errcheck
497-
498-
// THEN refresh the parent directory so it sees the newly indexed child
499494
parentDir := filepath.Dir(realdst)
500495
RefreshIndex(destIndex, parentDir, true, false) //nolint:errcheck
501496
}()
502497
} else {
503-
// If moving a file, just refresh the parent directory
504498
parentDir := filepath.Dir(realdst)
505499
go RefreshIndex(destIndex, parentDir, true, false) //nolint:errcheck
506500
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//go:build !windows
2+
3+
package fileutils
4+
5+
import (
6+
"syscall"
7+
)
8+
9+
// GetPartitionSize returns the filesystem size for Unix systems
10+
func GetPartitionSize(path string) (uint64, error) {
11+
var stat syscall.Statfs_t
12+
err := syscall.Statfs(path, &stat)
13+
if err != nil {
14+
return 0, err
15+
}
16+
// Total size in bytes: Blocks * Block size
17+
total := uint64(stat.Blocks) * uint64(stat.Bsize)
18+
return total, nil
19+
}
20+
21+
// GetFreeSpace returns the available free space for Unix systems
22+
func GetFreeSpace(path string) (uint64, error) {
23+
var stat syscall.Statfs_t
24+
err := syscall.Statfs(path, &stat)
25+
if err != nil {
26+
return 0, err
27+
}
28+
// Available free space in bytes: Available blocks * Block size
29+
free := uint64(stat.Bavail) * uint64(stat.Bsize)
30+
return free, nil
31+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//go:build windows
2+
3+
package fileutils
4+
5+
import (
6+
"golang.org/x/sys/windows"
7+
)
8+
9+
// GetPartitionSize returns the filesystem size for Windows systems
10+
func GetPartitionSize(path string) (uint64, error) {
11+
pathPtr, err := windows.UTF16PtrFromString(path)
12+
if err != nil {
13+
return 0, err
14+
}
15+
var freeBytes, totalBytes, totalFreeBytes uint64
16+
err = windows.GetDiskFreeSpaceEx(pathPtr, &freeBytes, &totalBytes, &totalFreeBytes)
17+
if err != nil {
18+
return 0, err
19+
}
20+
return totalBytes, nil
21+
}
22+
23+
// GetFreeSpace returns the available free space for Windows systems
24+
func GetFreeSpace(path string) (uint64, error) {
25+
pathPtr, err := windows.UTF16PtrFromString(path)
26+
if err != nil {
27+
return 0, err
28+
}
29+
var freeBytes, totalBytes, totalFreeBytes uint64
30+
err = windows.GetDiskFreeSpaceEx(pathPtr, &freeBytes, &totalBytes, &totalFreeBytes)
31+
if err != nil {
32+
return 0, err
33+
}
34+
return freeBytes, nil
35+
}

backend/auth/json.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ func (auther JSONAuth) Auth(r *http.Request, userStore *users.Storage) (*users.U
2222
username := r.URL.Query().Get("username")
2323
recaptcha := r.URL.Query().Get("recaptcha")
2424
password := r.Header.Get("X-Password")
25+
// URL-decode password to support special characters in headers
26+
password, err := url.QueryUnescape(password)
27+
if err != nil {
28+
return nil, fmt.Errorf("invalid password encoding: %v", err)
29+
}
2530
totpCode := r.Header.Get("X-Secret")
2631

2732
// If ReCaptcha is enabled, check the code.

0 commit comments

Comments
 (0)