Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50125a5d21 | ||
|
|
bc3d75a94a | ||
|
|
fb6aeba9ea | ||
|
|
67e893eee7 | ||
|
|
4a4b0f8c84 | ||
|
|
660d84661d | ||
|
|
392253c563 | ||
|
|
328f629181 | ||
|
|
4c3cb4bc9b | ||
|
|
3213b605be | ||
|
|
610e0b09e9 | ||
|
|
7453c78c98 | ||
|
|
cd5749dff8 | ||
|
|
4daddec6f2 | ||
|
|
9bd79c3aae | ||
|
|
6c69b5cd89 | ||
|
|
4b8a8d72ce | ||
|
|
8ddd3d1db9 | ||
|
|
9fffee387f | ||
|
|
5a12cad548 | ||
|
|
6232686e22 | ||
|
|
b21b1245ae | ||
|
|
7361d91ea2 | ||
|
|
c05c668148 | ||
|
|
b7dc392838 | ||
|
|
ac46cf0671 | ||
|
|
f0785391bf | ||
|
|
9b78324d77 | ||
|
|
fe7efb2e6a | ||
|
|
2651260a1c | ||
|
|
4470288ba1 | ||
|
|
58d22578e8 | ||
|
|
dfc2e887e1 | ||
|
|
aac2516637 | ||
|
|
c05ead7e8e | ||
|
|
d76b7d1610 | ||
|
|
f30fca636c | ||
|
|
ec13054671 | ||
|
|
883a36f02f | ||
|
|
8503ba61ff | ||
|
|
1fb05d65de | ||
|
|
2472fbcd30 | ||
|
|
43a404ca69 | ||
|
|
d9cf2f0100 | ||
|
|
6209f8fddd |
No files matched your search
@@ -0,0 +1,160 @@
|
||||
# CLAUDE.md
|
||||
|
||||
Guidance for Claude when working in this repository (File Browser, `filebrowser/filebrowser`).
|
||||
|
||||
## Repo orientation
|
||||
|
||||
- Go backend (`github.com/filebrowser/filebrowser/v2`, ecosystem `go`) + Vue frontend under `frontend/`.
|
||||
- The project is in **maintenance-only mode** (see `SECURITY.md`). Prefer small, surgical, well-tested changes.
|
||||
- Version scheme: `v2.63.x`. Conventional-commit messages (`fix(scope): …`, `feat: …`, `chore: …`).
|
||||
- Verify with `go build ./...`, `go vet ./...`, `go test ./...`. Reuse existing test harnesses (e.g. `signToken`, `scopedUserStorage`, `handle`, `customFSUser`, `mockUserStore`).
|
||||
|
||||
---
|
||||
|
||||
# Handling security advisories
|
||||
|
||||
Use this playbook when asked to triage, verify, fix, or manage GitHub security advisories.
|
||||
All advisory state lives on GitHub and is driven with the `gh` CLI. States are
|
||||
`triage → draft → published`, plus `closed`.
|
||||
|
||||
## 1. Fetch
|
||||
|
||||
```bash
|
||||
# List by state (also: published, draft, closed)
|
||||
gh api '/repos/filebrowser/filebrowser/security-advisories?state=triage&per_page=100' \
|
||||
--jq '.[] | {ghsa_id, severity, summary, state}'
|
||||
|
||||
# Full report for one advisory (read .summary and .description)
|
||||
gh api /repos/filebrowser/filebrowser/security-advisories/GHSA-xxxx-xxxx-xxxx \
|
||||
--jq '.summary, "---", .description'
|
||||
```
|
||||
|
||||
Always pull the **published** set too — you need it to dedup against.
|
||||
|
||||
## 2. Verify each report — do NOT trust the report text
|
||||
|
||||
Read the actual source **at HEAD** and reach one verdict per advisory:
|
||||
|
||||
- **CONFIRMED** — defect exists at HEAD. Quote the exact `file:line`.
|
||||
- **FIXED** — already patched (find the fix commit).
|
||||
- **FALSE / NOT APPLICABLE** — claim is wrong, or targets a different project.
|
||||
- **NOT EXPLOITABLE** — pattern exists but no code path can reach the precondition.
|
||||
- **DUPLICATE** — of a published advisory, or of another triage advisory.
|
||||
|
||||
Common traps — check each before accepting a report:
|
||||
|
||||
- **"Incomplete fix of a prior advisory."** Read the original fix commit and confirm the *specific*
|
||||
sibling code path is actually still unguarded — a prior fix may already cover a related path.
|
||||
- **Wrong project.** Confirm the referenced files, symbols, and endpoints exist in this repo; reports
|
||||
sometimes describe a fork. If the cited code isn't here, close as not applicable.
|
||||
- **"Legacy / upgraded / imported records are affected."** Trace the field's git history and confirm that
|
||||
some released version could actually produce such a record before believing it
|
||||
(`git log -S'Field' -- path`, `git show <commit>`, `git tag --contains <commit>`).
|
||||
- **Overlapping reports.** Two triage advisories may share one root cause — consolidate and fix once.
|
||||
- **Known, intentionally-unaddressed classes.** Some areas are known and tracked but not fixed (see
|
||||
`SECURITY.md`'s Known Issues); matching reports are duplicates.
|
||||
|
||||
Record, per advisory: verdict, the `file:line` evidence, exploitability preconditions
|
||||
(default config? platform-specific? auth required?), and the disposition.
|
||||
|
||||
## 3. Fix (one commit per advisory)
|
||||
|
||||
- Branch off `master` first; never commit fixes directly to `master`.
|
||||
- **One commit per fix**, each referencing the GHSA in the body (`Refs GHSA-xxxx-xxxx-xxxx`).
|
||||
- When several advisories share a root cause because parallel code paths diverged, **centralize** the logic
|
||||
(e.g. `settings.CreateUserHome` used by signup, proxy, and hook provisioning) so they cannot drift again.
|
||||
- Keep it surgical; match surrounding style.
|
||||
|
||||
## 4. Add a regression test per fix
|
||||
|
||||
- Reuse the existing harnesses; add a focused test asserting the fixed behavior (and that the legitimate
|
||||
path still works). Commit tests alongside or right after the fixes (`test(scope): …`, `Refs GHSA-…`).
|
||||
- Run `go test ./... && go vet ./...` before finishing.
|
||||
|
||||
## 5. Severity — set a CVSS vector, don't hand-assert
|
||||
|
||||
Set a CVSS v3.1 vector; GitHub derives the score **and** severity from it (overriding the plain `severity`
|
||||
field). Encode the real preconditions in the vector so the band is defensible:
|
||||
|
||||
- Requires a specific target configuration/platform (e.g. case-insensitive FS) → **AC:H**.
|
||||
- Unauthenticated vs needs an account → **PR:N / PR:L**.
|
||||
- Keep it consistent with the **predecessor CVE's** rating (an incomplete-fix follow-up should not outrank
|
||||
its parent). Bands: `0.1–3.9` low, `4.0–6.9` medium, `7.0–8.9` high, `9.0–10.0` critical.
|
||||
|
||||
```bash
|
||||
gh api -X PATCH /repos/filebrowser/filebrowser/security-advisories/GHSA-xxxx-xxxx-xxxx \
|
||||
-f cvss_vector_string='CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H' \
|
||||
--jq '{ghsa_id, severity, score: .cvss.score, vector: .cvss.vector_string}'
|
||||
```
|
||||
|
||||
## 6. Clean up the title
|
||||
|
||||
Rewrite reporter titles to the concise, sentence-case, backtick-free style of the published advisories
|
||||
(state the vuln; drop "Incomplete fix of…" prefixes and jargon). The title is the `summary` field:
|
||||
|
||||
```bash
|
||||
gh api -X PATCH .../security-advisories/GHSA-xxxx-xxxx-xxxx \
|
||||
-f summary='Proxy-auth auto-provisioning ignores createUserDir and grants the server root scope'
|
||||
```
|
||||
|
||||
## 7. Rewrite the body into the standard structure
|
||||
|
||||
Reporter reports arrive in whatever shape the reporter used. Before drafting, rewrite the
|
||||
`description` into the sections below — **reusing the reporter's own wording wherever it is
|
||||
accurate**, rather than paraphrasing it. Drop the greeting, the offer to help, and any claim the
|
||||
verification in step 2 disproved. Keep sections in this order and omit the ones that don't apply:
|
||||
|
||||
| Section | Contents |
|
||||
| --- | --- |
|
||||
| `## Summary` | What the defect is, in two or three sentences. Note the version it was reported against and the range it was verified over. |
|
||||
| `## Details` | Root cause, naming `file.go`, the function, and a short quote of the **pre-fix** code. |
|
||||
| `## PoC` | The reporter's reproduction steps and observed result, trimmed to the essentials. |
|
||||
| `## Impact` | Who can exploit it (privilege level, preconditions) and what they get. |
|
||||
| `## Patches` | Fixed version plus a link to the fix commit, and one sentence on what the fix does. Mention it if the reporter re-tested and confirmed. |
|
||||
| `## Workarounds` | Real mitigations, or `None. Upgrade to vX.Y.Z.` |
|
||||
| `## Out of scope` | Anything in the original report deliberately **not** treated as a vulnerability, with the reasoning. Needed whenever the advisory is narrower than the report. |
|
||||
| `## References` | Fix and regression-test commit links. |
|
||||
|
||||
Use `##` headings (matching the published advisories) and keep the body in the maintainer's voice —
|
||||
first person ("I reproduced…") belongs only inside quoted PoC steps.
|
||||
|
||||
Send it as a file so the Markdown survives shell quoting:
|
||||
|
||||
```bash
|
||||
jq -Rs '{description: .}' desc.md \
|
||||
| gh api -X PATCH .../security-advisories/GHSA-xxxx-xxxx-xxxx --input -
|
||||
```
|
||||
|
||||
## 8. Set affected & patched versions
|
||||
|
||||
The package is always `{ecosystem: "go", name: "github.com/filebrowser/filebrowser/v2"}`.
|
||||
|
||||
- `vulnerable_version_range` — `<= <latest released version>` (the newest tag; find it with
|
||||
`git tag --list 'v2.*' --sort=-version:refname | head -1`).
|
||||
- `patched_versions` — the **next** release that will actually ship the fix. It doesn't exist just
|
||||
because the branch does; it still has to be cut. **When unsure which version that will be, ask.**
|
||||
|
||||
Replace the placeholder versions below before sending:
|
||||
|
||||
```bash
|
||||
printf '%s' '{"vulnerabilities":[{"package":{"ecosystem":"go","name":"github.com/filebrowser/filebrowser/v2"},"vulnerable_version_range":"<= <latest>","patched_versions":"<next>","vulnerable_functions":[]}]}' \
|
||||
| gh api -X PATCH .../security-advisories/GHSA-xxxx-xxxx-xxxx --input -
|
||||
```
|
||||
|
||||
## 9. Move state / close, by disposition
|
||||
|
||||
```bash
|
||||
gh api -X PATCH .../security-advisories/GHSA-xxxx-xxxx-xxxx -f state=draft # fixed, awaiting release
|
||||
gh api -X PATCH .../security-advisories/GHSA-xxxx-xxxx-xxxx -f state=closed # duplicate / N-A / not-exploitable
|
||||
```
|
||||
|
||||
- **CONFIRMED & fixed** → metadata done → **draft**. Publish after the patched release ships.
|
||||
- **DUPLICATE / NOT APPLICABLE / NOT EXPLOITABLE** → **closed**.
|
||||
- **DEFERRED** (confirmed but not yet fixed) → leave in **triage** with a note.
|
||||
- The REST API **cannot post advisory comments** — replies to reporters (dup notice, evidence, links to
|
||||
the relevant tracking issue) must be posted manually in the advisory UI. Draft the text for the maintainer.
|
||||
|
||||
## 10. Release & publish
|
||||
|
||||
Push the branch, open a PR, merge, tag/release the `patched_versions` you set, then publish the drafts.
|
||||
Confirm outward-facing/irreversible advisory actions (close, publish) with the maintainer before doing them.
|
||||
@@ -2,6 +2,48 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
||||
|
||||
## [2.63.20](https://github.com/filebrowser/filebrowser/compare/v2.63.19...v2.63.20) (2026-07-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use aria-selected ([67e893e](https://github.com/filebrowser/filebrowser/commit/67e893eee7ee411e166d3fcd759a87b6f0971277))
|
||||
* **users:** make the provisioned scope check atomic with the save ([fb6aeba](https://github.com/filebrowser/filebrowser/commit/fb6aeba9eae7b8eb401e0db325973781e1ffd08b))
|
||||
## [2.63.19](https://github.com/filebrowser/filebrowser/compare/v2.63.18...v2.63.19) (2026-07-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* accessibility and security improvements ([#6033](https://github.com/filebrowser/filebrowser/issues/6033)) ([b21b124](https://github.com/filebrowser/filebrowser/commit/b21b1245ae1b57f031b2f5d787f32a17532402c0))
|
||||
* **auth:** isolate auto-provisioned proxy and hook users to their own home ([8ddd3d1](https://github.com/filebrowser/filebrowser/commit/8ddd3d1db9b9f5727d0bf96ea0e7d9a25a8692b4))
|
||||
* **http:** delete abandoned TUS uploads through the scoped filesystem ([9bd79c3](https://github.com/filebrowser/filebrowser/commit/9bd79c3aaeb4a55b0e69cf8976c4a258db2f5e06))
|
||||
* **http:** enforce declared Upload-Length on TUS uploads ([4daddec](https://github.com/filebrowser/filebrowser/commit/4daddec6f200b03a721197d8c0b4b652c994894e))
|
||||
* **http:** enforce download permission on the checksum branch ([6c69b5c](https://github.com/filebrowser/filebrowser/commit/6c69b5cd895e15b29e563200a9a6dfc27b06525e))
|
||||
* **http:** run upload hooks for directories ([#6034](https://github.com/filebrowser/filebrowser/issues/6034)) ([9b78324](https://github.com/filebrowser/filebrowser/commit/9b78324d773c790951cc6a97840c4b55f66b5f3d))
|
||||
* process --FollowExternalSymlinks ([c05c668](https://github.com/filebrowser/filebrowser/commit/c05c66814891c3cccef394162e428444b53394e4))
|
||||
* return error instead of panicking on an unreadable directory during copy ([#6020](https://github.com/filebrowser/filebrowser/issues/6020)) ([ac46cf0](https://github.com/filebrowser/filebrowser/commit/ac46cf06719575477d5125e7472037c204b3702d))
|
||||
* **storage:** reject case-folded home directory collisions ([4b8a8d7](https://github.com/filebrowser/filebrowser/commit/4b8a8d72ce554dde378b5091da74aa930ea18327))
|
||||
* **upload:** handle encoded path conflicts safely ([#6040](https://github.com/filebrowser/filebrowser/issues/6040)) ([7361d91](https://github.com/filebrowser/filebrowser/commit/7361d91ea2e8cc200a0f40ac84adcd02aedc9ed2))
|
||||
## [2.63.18](https://github.com/filebrowser/filebrowser/compare/v2.63.17...v2.63.18) (2026-07-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* avoid recursive conflict checks for copy and move ([#6009](https://github.com/filebrowser/filebrowser/issues/6009)) ([dfc2e88](https://github.com/filebrowser/filebrowser/commit/dfc2e887e1a19d54984a0d7e39a2a63caf73ef19))
|
||||
* deduplicate PT language ([4470288](https://github.com/filebrowser/filebrowser/commit/4470288ba1828a14453a99348fd22c62aa0b9460))
|
||||
* **preview:** keep the EPUB table-of-contents button clear of the header ([#6010](https://github.com/filebrowser/filebrowser/issues/6010)) ([aac2516](https://github.com/filebrowser/filebrowser/commit/aac25166378422135e624e305c410c54a39374fb))
|
||||
|
||||
## [2.63.17](https://github.com/filebrowser/filebrowser/compare/v2.63.16...v2.63.17) (2026-06-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **auth:** reject signup when normalized home dir collides (GHSA-7rc3-g7h6-22m7) ([883a36f](https://github.com/filebrowser/filebrowser/commit/883a36f02fcb69566a8628cb47f18fdc73348387))
|
||||
* match admin share paths by owner scope ([#5992](https://github.com/filebrowser/filebrowser/issues/5992)) ([43a404c](https://github.com/filebrowser/filebrowser/commit/43a404ca69bf25553bfbbb2b446f0f53077c6302))
|
||||
* normalize recursive listing paths to forward slashes ([#6003](https://github.com/filebrowser/filebrowser/issues/6003)) ([2472fbc](https://github.com/filebrowser/filebrowser/commit/2472fbcd30502606feb11fbc8b8dc4f3803e6641))
|
||||
* preserve SRT subtitle line breaks ([#6002](https://github.com/filebrowser/filebrowser/issues/6002)) ([d9cf2f0](https://github.com/filebrowser/filebrowser/commit/d9cf2f0100d2c4892cad8e339eacca96df1aa5b6))
|
||||
* **raw:** neutralize backslashes in archive entry names (GHSA-83xp-526h-j3ww) ([8503ba6](https://github.com/filebrowser/filebrowser/commit/8503ba61ff51d48a7313896483d130eb6a5abfe0))
|
||||
* **share:** delete exact directory share on trailing-slash delete (GHSA-pp88-jhwj-5qh5) ([f30fca6](https://github.com/filebrowser/filebrowser/commit/f30fca636c1af9ef401e9a82ff60391cb3db97e1))
|
||||
* **share:** stop exposing password hash and bypass token in share API (GHSA-833g-cqhp-h72j) ([ec13054](https://github.com/filebrowser/filebrowser/commit/ec130546713c44cd24556907552ac554c7f809c9))
|
||||
|
||||
## [2.63.16](https://github.com/filebrowser/filebrowser/compare/v2.63.15...v2.63.16) (2026-06-23)
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
</p>
|
||||
|
||||
[](https://github.com/filebrowser/filebrowser/actions/workflows/ci.yaml)
|
||||
[](https://goreportcard.com/report/github.com/filebrowser/filebrowser/v2)
|
||||
[](https://github.com/filebrowser/filebrowser/releases/latest)
|
||||
|
||||
File Browser provides a file managing interface within a specified directory and it can be used to upload, delete, preview and edit your files. It is a **create-your-own-cloud**-kind of software where you can just install it on your server, direct it to a path and access your files through a nice web interface.
|
||||
@@ -19,7 +18,7 @@ This project is a finished product which fulfills its goal: be a single binary w
|
||||
- It can take a while until someone gets back to you. Please be patient.
|
||||
- [Issues](https://github.com/filebrowser/filebrowser/issues) are meant to track bugs. Unrelated issues will be converted into [discussions](https://github.com/filebrowser/filebrowser/discussions).
|
||||
- The priority is triaging issues, addressing security issues and reviewing pull requests meant to solve bugs.
|
||||
- No new features are planned. Pull requests for new features are not guaranteed to be reviewed.
|
||||
- No new features are planned. Pull requests for new features will not be reviewed.
|
||||
|
||||
Please read [@hacdias' personal reflection](https://hacdias.com/2026/03/11/filebrowser/) on the project status.
|
||||
|
||||
|
||||
+22
-15
@@ -2,25 +2,32 @@
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Use this section to tell people about which versions of your project are
|
||||
currently being supported with security updates.
|
||||
| Version | Supported |
|
||||
| ------- | --------- |
|
||||
| 2.x | ✅ |
|
||||
| < 2.0 | ❌ |
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 2.x | :white_check_mark: |
|
||||
| < 2.0 | :x: |
|
||||
## Before Reporting
|
||||
|
||||
This project is in maintenance-only mode. To avoid duplicates, first check the [existing advisories](https://github.com/filebrowser/filebrowser/security/advisories) and open issues, and confirm:
|
||||
|
||||
- **It concerns this project, not a fork.** Reports about code, features, or endpoints that don't exist here belong to the relevant fork.
|
||||
- **It isn't an already-known class** that remains unaddressed:
|
||||
- Command execution, runner, and hooks (opt-in, disabled by default) — [#5199](https://github.com/filebrowser/filebrowser/issues/5199)
|
||||
- Session and JWT handling — [#5216](https://github.com/filebrowser/filebrowser/issues/5216)
|
||||
|
||||
Reports covering these are likely to be closed as duplicates.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Vulnerabilities with critical impact should be reported on the [Security](https://github.com/filebrowser/filebrowser/security) page of this repository, which is a private way of communicating vulnerabilities to maintainers. This project is in maintenance-only mode and it can take a while until someone gets back to you.
|
||||
- **Critical:** report privately via the [Security](https://github.com/filebrowser/filebrowser/security) page.
|
||||
- **Non-critical:** open a public issue so the community can help; we'll label it as a security issue.
|
||||
|
||||
If it is not a critical vulnerability, please open an issue and we will categorize it as a security issue. By giving visibility, we can get more help from the community at fixing such issues.
|
||||
Please include, where possible:
|
||||
|
||||
When reporting an issue, where possible, please provide at least:
|
||||
- The commit the issue was found at
|
||||
- A plaintext proof of concept (no binaries)
|
||||
- Steps to reproduce
|
||||
- Recommended remediation, if any
|
||||
|
||||
* The commit version the issue was identified at
|
||||
* A proof of concept (plaintext; no binaries)
|
||||
* Steps to reproduce
|
||||
* Your recommended remediation(s), if any.
|
||||
|
||||
The File Browser team is a volunteer-only effort, and may reach back out for clarification.
|
||||
We're a volunteer effort, so responses can take a while, and we may reach out for clarification.
|
||||
+7
-6
@@ -157,15 +157,16 @@ func (a *HookAuth) SaveUser() (*users.User, error) {
|
||||
}
|
||||
u = a.GetUser(d)
|
||||
|
||||
userHome, err := a.Settings.MakeUserDir(u.Username, u.Scope, a.Server.Root)
|
||||
// A scope explicitly returned by the hook takes precedence over the
|
||||
// automatic per-user home directory derivation.
|
||||
_, explicitScope := a.Fields.Values["user.scope"]
|
||||
derivedScope, err := a.Settings.CreateUserHome(u, a.Server.Root, explicitScope)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("user: failed to mkdir user home dir: [%s]", userHome)
|
||||
return nil, err
|
||||
}
|
||||
u.Scope = userHome
|
||||
log.Printf("user: %s, home dir: [%s].", u.Username, userHome)
|
||||
log.Printf("user: %s, home dir: [%s].", u.Username, u.Scope)
|
||||
|
||||
err = a.Users.Save(u)
|
||||
if err != nil {
|
||||
if err := a.Users.SaveProvisioned(u, derivedScope); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if p := !users.CheckPwd(a.Cred.Password, u.Password); len(a.Fields.Values) > 1 || p {
|
||||
|
||||
@@ -5,6 +5,9 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/settings"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
)
|
||||
|
||||
// writeHookScript writes a POSIX shell script to a temp file and returns its
|
||||
@@ -86,3 +89,68 @@ fi
|
||||
t.Fatalf("expected action %q, got %q", "auth", action)
|
||||
}
|
||||
}
|
||||
|
||||
// newHookAuth builds a HookAuth for a freshly provisioned user with the given
|
||||
// parsed hook fields (hook.action=auth is added automatically).
|
||||
func newHookAuth(store *mockUserStore, s *settings.Settings, srv *settings.Server, username string, fields map[string]string) *HookAuth {
|
||||
fields["hook.action"] = "auth"
|
||||
return &HookAuth{
|
||||
Users: store,
|
||||
Settings: s,
|
||||
Server: srv,
|
||||
Cred: hookCred{Username: username, Password: "a-strong-password"},
|
||||
Fields: hookFields{Values: fields},
|
||||
}
|
||||
}
|
||||
|
||||
// With CreateUserDir enabled and no explicit scope from the hook, a provisioned
|
||||
// hook user must receive its own home directory rather than the server root.
|
||||
func TestHookSaveUserCreateUserDirIsolatesScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
store := &mockUserStore{users: make(map[string]*users.User)}
|
||||
srv := &settings.Server{Root: t.TempDir()}
|
||||
s := &settings.Settings{
|
||||
Key: []byte("key"),
|
||||
CreateUserDir: true,
|
||||
UserHomeBasePath: "/users",
|
||||
Defaults: settings.UserDefaults{
|
||||
Scope: ".",
|
||||
Perm: users.Permissions{Create: true},
|
||||
},
|
||||
}
|
||||
|
||||
u, err := newHookAuth(store, s, srv, "alice", map[string]string{}).SaveUser()
|
||||
if err != nil {
|
||||
t.Fatalf("SaveUser error: %v", err)
|
||||
}
|
||||
if u.Scope != "/users/alice" {
|
||||
t.Errorf("hook user without explicit scope: expected /users/alice, got %q", u.Scope)
|
||||
}
|
||||
}
|
||||
|
||||
// A scope explicitly returned by the hook takes precedence over the automatic
|
||||
// per-user home directory derivation.
|
||||
func TestHookSaveUserRespectsExplicitScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
store := &mockUserStore{users: make(map[string]*users.User)}
|
||||
srv := &settings.Server{Root: t.TempDir()}
|
||||
s := &settings.Settings{
|
||||
Key: []byte("key"),
|
||||
CreateUserDir: true,
|
||||
UserHomeBasePath: "/users",
|
||||
Defaults: settings.UserDefaults{
|
||||
Scope: ".",
|
||||
Perm: users.Permissions{Create: true},
|
||||
},
|
||||
}
|
||||
|
||||
u, err := newHookAuth(store, s, srv, "teamlead", map[string]string{"user.scope": "/shared/team"}).SaveUser()
|
||||
if err != nil {
|
||||
t.Fatalf("SaveUser error: %v", err)
|
||||
}
|
||||
if u.Scope != "/shared/team" {
|
||||
t.Errorf("explicit hook scope should win, got %q", u.Scope)
|
||||
}
|
||||
}
|
||||
+3
-6
@@ -50,15 +50,12 @@ func (a ProxyAuth) createUser(usr users.Store, setting *settings.Settings, srv *
|
||||
user.Perm.Execute = false
|
||||
user.Commands = []string{}
|
||||
|
||||
var userHome string
|
||||
userHome, err = setting.MakeUserDir(user.Username, user.Scope, srv.Root)
|
||||
if err != nil {
|
||||
var derivedScope bool
|
||||
if derivedScope, err = setting.CreateUserHome(user, srv.Root, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user.Scope = userHome
|
||||
|
||||
err = usr.Save(user)
|
||||
if err != nil {
|
||||
if err = usr.SaveProvisioned(user, derivedScope); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
fberrors "github.com/filebrowser/filebrowser/v2/errors"
|
||||
@@ -22,12 +23,31 @@ func (m *mockUserStore) Get(_ string, _ bool, id interface{}) (*users.User, erro
|
||||
return nil, fberrors.ErrNotExist
|
||||
}
|
||||
|
||||
func (m *mockUserStore) GetByScope(scope string) (*users.User, error) {
|
||||
for _, u := range m.users {
|
||||
if strings.EqualFold(u.Scope, scope) {
|
||||
return u, nil
|
||||
}
|
||||
}
|
||||
return nil, fberrors.ErrNotExist
|
||||
}
|
||||
|
||||
func (m *mockUserStore) Gets(_ string, _ bool) ([]*users.User, error) { return nil, nil }
|
||||
func (m *mockUserStore) Update(_ *users.User, _ ...string) error { return nil }
|
||||
func (m *mockUserStore) Save(user *users.User) error {
|
||||
m.users[user.Username] = user
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockUserStore) SaveProvisioned(user *users.User, derivedScope bool) error {
|
||||
if derivedScope {
|
||||
if _, err := m.GetByScope(user.Scope); err == nil {
|
||||
return fberrors.ErrExist
|
||||
}
|
||||
}
|
||||
return m.Save(user)
|
||||
}
|
||||
|
||||
func (m *mockUserStore) Delete(_ interface{}) error { return nil }
|
||||
func (m *mockUserStore) LastUpdate(_ uint) int64 { return 0 }
|
||||
|
||||
@@ -77,3 +97,46 @@ func TestProxyAuthCreateUserRestrictsDefaults(t *testing.T) {
|
||||
t.Error("auto-provisioned proxy user should retain Create permission from defaults")
|
||||
}
|
||||
}
|
||||
|
||||
// With CreateUserDir enabled, two distinct proxy-authenticated users must each
|
||||
// receive their own home directory instead of both inheriting the server root.
|
||||
func TestProxyAuthCreateUserDirIsolatesScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
store := &mockUserStore{users: make(map[string]*users.User)}
|
||||
srv := &settings.Server{Root: t.TempDir()}
|
||||
s := &settings.Settings{
|
||||
Key: []byte("key"),
|
||||
AuthMethod: MethodProxyAuth,
|
||||
CreateUserDir: true,
|
||||
UserHomeBasePath: "/users",
|
||||
Defaults: settings.UserDefaults{
|
||||
Scope: ".",
|
||||
Perm: users.Permissions{Create: true},
|
||||
},
|
||||
}
|
||||
|
||||
auth := ProxyAuth{Header: "X-Remote-User"}
|
||||
provision := func(name string) *users.User {
|
||||
req, _ := http.NewRequest(http.MethodGet, "/", http.NoBody)
|
||||
req.Header.Set("X-Remote-User", name)
|
||||
u, err := auth.Auth(req, store, s, srv)
|
||||
if err != nil {
|
||||
t.Fatalf("Auth(%q) error: %v", name, err)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
alice := provision("alice")
|
||||
bob := provision("bob")
|
||||
|
||||
if alice.Scope == "/" || bob.Scope == "/" {
|
||||
t.Fatalf("provisioned users inherited the server root: alice=%q bob=%q", alice.Scope, bob.Scope)
|
||||
}
|
||||
if alice.Scope == bob.Scope {
|
||||
t.Fatalf("distinct users must get distinct scopes, both got %q", alice.Scope)
|
||||
}
|
||||
if alice.Scope != "/users/alice" {
|
||||
t.Errorf("expected /users/alice, got %q", alice.Scope)
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,10 @@ import (
|
||||
|
||||
"github.com/samber/lo"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/auth"
|
||||
"github.com/filebrowser/filebrowser/v2/settings"
|
||||
)
|
||||
|
||||
// TestEnvCollisions ensures that there are no collisions in the produced environment
|
||||
@@ -33,3 +37,25 @@ func testEnvCollisions(t *testing.T, cmd *cobra.Command) {
|
||||
t.Errorf("Found duplicate environment variable keys for command %q: %v", cmd.Name(), duplicates)
|
||||
}
|
||||
}
|
||||
|
||||
// TestGetSettingsFollowExternalSymlinks ensures that the followExternalSymlinks
|
||||
// flag is persisted to the server config when set via "config set".
|
||||
func TestGetSettingsFollowExternalSymlinks(t *testing.T) {
|
||||
flags := pflag.NewFlagSet("test", pflag.ContinueOnError)
|
||||
addConfigFlags(flags)
|
||||
|
||||
if err := flags.Parse([]string{"--followExternalSymlinks"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
set := &settings.Settings{AuthMethod: auth.MethodJSONAuth}
|
||||
ser := &settings.Server{}
|
||||
|
||||
if _, err := getSettings(flags, set, ser, &auth.JSONAuth{}, false); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !ser.FollowExternalSymlinks {
|
||||
t.Error("expected FollowExternalSymlinks to be persisted as true")
|
||||
}
|
||||
}
|
||||
@@ -314,6 +314,8 @@ func getSettings(flags *pflag.FlagSet, set *settings.Settings, ser *settings.Ser
|
||||
case "disableImageResolutionCalc":
|
||||
ser.ImageResolutionCal, err = flags.GetBool(flag.Name)
|
||||
ser.ImageResolutionCal = !ser.ImageResolutionCal
|
||||
case "followExternalSymlinks":
|
||||
ser.FollowExternalSymlinks, err = flags.GetBool(flag.Name)
|
||||
|
||||
// Settings flags from [addConfigFlags]
|
||||
case "signup":
|
||||
|
||||
+13
@@ -13,6 +13,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -381,6 +382,18 @@ func getServerSettings(v *viper.Viper, st *storage.Storage) (*settings.Server, e
|
||||
log.Println("WARNING: you fully understand and trust the contents of every user scope.")
|
||||
}
|
||||
|
||||
if set, err := st.Settings.Get(); err == nil && set.Signup {
|
||||
scope := strings.TrimSpace(set.Defaults.Scope)
|
||||
scopeIsRoot := scope == "" || scope == "." || scope == "/"
|
||||
|
||||
if !set.CreateUserDir && scopeIsRoot {
|
||||
log.Println("WARNING: Signup is enabled without createUserDir and the default scope is")
|
||||
log.Println("WARNING: the server root, so every self-registered user can read, modify and")
|
||||
log.Println("WARNING: delete all files File Browser serves, including other users' files.")
|
||||
log.Println("WARNING: Enable createUserDir, or set a default scope other than the root.")
|
||||
}
|
||||
}
|
||||
|
||||
return server, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package fileutils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@@ -9,6 +10,54 @@ import (
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
// failingOpenFs wraps an afero.Fs and makes Open fail for one specific path,
|
||||
// while every other operation (including Stat) is delegated unchanged. It
|
||||
// simulates a directory that can be stat-ed but not opened/read — for example
|
||||
// an unreadable sub-directory, or one whose permissions changed or that was
|
||||
// removed after its parent was listed (a TOCTOU race) — encountered during a
|
||||
// recursive copy.
|
||||
type failingOpenFs struct {
|
||||
afero.Fs
|
||||
failOpen string
|
||||
}
|
||||
|
||||
func (f *failingOpenFs) Open(name string) (afero.File, error) {
|
||||
if path.Clean(name) == path.Clean(f.failOpen) {
|
||||
return nil, os.ErrPermission
|
||||
}
|
||||
return f.Fs.Open(name)
|
||||
}
|
||||
|
||||
// CopyDir is documented to keep going when it hits an error and to report the
|
||||
// error afterwards. A sub-directory that cannot be opened must therefore yield
|
||||
// an error (and leave the other, readable entries copied) rather than
|
||||
// panicking on a nil directory handle.
|
||||
func TestCopyDirUnreadableSubdirReturnsError(t *testing.T) {
|
||||
mem := afero.NewMemMapFs()
|
||||
if err := mem.MkdirAll("/srcdir/sub", 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := afero.WriteFile(mem, "/srcdir/ok.txt", []byte("readable"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
afs := &failingOpenFs{Fs: mem, failOpen: "/srcdir/sub"}
|
||||
|
||||
err := Copy(afs, "/srcdir", "/dstdir", 0o644, 0o755)
|
||||
if err == nil {
|
||||
t.Fatal("expected an error when a sub-directory cannot be opened")
|
||||
}
|
||||
|
||||
// The readable sibling must still have been copied (continue-on-error).
|
||||
data, readErr := afero.ReadFile(afs, "/dstdir/ok.txt")
|
||||
if readErr != nil {
|
||||
t.Fatalf("readable sibling was not copied: %v", readErr)
|
||||
}
|
||||
if string(data) != "readable" {
|
||||
t.Fatalf("unexpected copied content: %q", string(data))
|
||||
}
|
||||
}
|
||||
|
||||
// Copying an in-scope directory that contains a symlink whose target escapes
|
||||
// the user's scope must not dereference that symlink into the destination.
|
||||
// Otherwise a scoped user could exfiltrate out-of-scope file content via the
|
||||
|
||||
+6
-1
@@ -23,7 +23,12 @@ func CopyDir(afs afero.Fs, source, dest string, fileMode, dirMode fs.FileMode) e
|
||||
return err
|
||||
}
|
||||
|
||||
dir, _ := afs.Open(source)
|
||||
dir, err := afs.Open(source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dir.Close()
|
||||
|
||||
obs, err := dir.Readdir(-1)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, user-scalable=no"
|
||||
content="width=device-width, initial-scale=1"
|
||||
/>
|
||||
|
||||
[{[ if .ReCaptcha -]}]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1 class="sr-only">{{ name }}</h1>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
@@ -9,6 +10,7 @@ import { ref, onMounted, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { setHtmlLocale } from "./i18n";
|
||||
import { getMediaPreference, getTheme, setTheme } from "./utils/theme";
|
||||
import { name } from "./utils/constants";
|
||||
|
||||
const { locale } = useI18n();
|
||||
|
||||
@@ -31,3 +33,17 @@ watch(locale, (newValue) => {
|
||||
newValue && setHtmlLocale(newValue);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -57,6 +57,9 @@ const container = ref<HTMLDivElement | null>(null);
|
||||
onMounted(() => {
|
||||
if (!decodeUTIF() && imgex.value !== null) {
|
||||
imgex.value.src = props.src;
|
||||
imgex.value.alt = decodeURIComponent(
|
||||
props.src.split("/").pop() || "preview"
|
||||
);
|
||||
}
|
||||
|
||||
props.classList.forEach((className) =>
|
||||
@@ -88,6 +91,9 @@ watch(
|
||||
() => {
|
||||
if (!decodeUTIF() && imgex.value !== null) {
|
||||
imgex.value.src = props.src;
|
||||
imgex.value.alt = decodeURIComponent(
|
||||
props.src.split("/").pop() || "preview"
|
||||
);
|
||||
}
|
||||
|
||||
scale.value = 1;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<img
|
||||
v-if="!readOnly && type === 'image' && isThumbsEnabled"
|
||||
v-lazy="thumbnailUrl"
|
||||
:alt="name"
|
||||
/>
|
||||
<i v-else class="material-icons"></i>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<header>
|
||||
<img v-if="showLogo" :src="logoURL" />
|
||||
<img v-if="showLogo" :src="logoURL" alt="File Browser" />
|
||||
<Action
|
||||
v-if="showMenu"
|
||||
class="menu-button"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
class="action"
|
||||
:aria-label="$t('buttons.copyDownloadLinkToClipboard')"
|
||||
:title="$t('buttons.copyDownloadLinkToClipboard')"
|
||||
:disabled="!!link.password_hash"
|
||||
:disabled="!!link.hasPassword"
|
||||
@click="copyToClipboard(buildDownloadLink(link))"
|
||||
>
|
||||
<i class="material-icons">content_paste_go</i>
|
||||
|
||||
@@ -71,7 +71,9 @@ const event = {
|
||||
describe("copy and move conflict prompts", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(checkConflict).mockResolvedValue(conflict);
|
||||
vi.mocked(checkConflict).mockResolvedValue(
|
||||
conflict as ConflictingResource[]
|
||||
);
|
||||
});
|
||||
|
||||
it("waits for copy conflict detection before calling the copy API", async () => {
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
|
||||
.epub-reader .tocButton {
|
||||
color: var(--text);
|
||||
/*
|
||||
* vue-reader positions the TOC toggle at top: 10px, which lands under the
|
||||
* fixed 4em header bar (see .header) — so clicks hit the header's Close
|
||||
* button instead of opening the table of contents. Push it just below the
|
||||
* header, tracking the header's height so it stays clear if that changes.
|
||||
*/
|
||||
top: calc(4em + 10px);
|
||||
}
|
||||
|
||||
.epub-reader .tocButton.tocButtonExpanded {
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
"rename": "Umbenennen",
|
||||
"replace": "Ersetzen",
|
||||
"reportIssue": "Problem melden",
|
||||
"resumeTransfer": "Resume previous transfer",
|
||||
"resumeTransferTooltip": "Skip all conflicting files, except the ones that are smaller on the server as we suppose that their transfert has been interrupted.",
|
||||
"resumeTransfer": "Vorherige Übertragung fortsetzen",
|
||||
"resumeTransferTooltip": "Alle Dateien mit Konflikten überspringen, außer denen, die auf dem Server kleiner sind, da wir davon ausgehen, dass deren Übertragung unterbrochen wurde.",
|
||||
"save": "Speichern",
|
||||
"schedule": "Planen",
|
||||
"search": "Suchen",
|
||||
@@ -283,7 +283,7 @@
|
||||
"currentPassword": "Dein aktuelles Passwort"
|
||||
},
|
||||
"sidebar": {
|
||||
"diskUsed": "{used} of {total} used",
|
||||
"diskUsed": "{used} von {total} belegt",
|
||||
"help": "Hilfe",
|
||||
"hugoNew": "Hugo Neu",
|
||||
"login": "Anmelden",
|
||||
|
||||
+25
-25
@@ -120,12 +120,12 @@
|
||||
"passwordsDontMatch": "Les mots de passe ne concordent pas",
|
||||
"signup": "S'inscrire",
|
||||
"submit": "Se connecter",
|
||||
"username": "Utilisateur",
|
||||
"usernameTaken": "Le nom d'utilisateur est déjà pris",
|
||||
"username": "Identifiant",
|
||||
"usernameTaken": "L'identifiant est déjà pris",
|
||||
"wrongCredentials": "Identifiants incorrects !",
|
||||
"passwordTooShort": "Le mot de passe doit contenir au moins {min} caractères",
|
||||
"logout_reasons": {
|
||||
"inactivity": "Vous avez été déconnecté(e) en raison d'une inactivité prolongée."
|
||||
"inactivity": "Vous avez été déconnecté'e en raison d'une inactivité prolongée."
|
||||
}
|
||||
},
|
||||
"permanent": "Permanent",
|
||||
@@ -194,12 +194,12 @@
|
||||
"settings": {
|
||||
"aceEditorTheme": "Éditeur de Thème Ace",
|
||||
"admin": "Admin",
|
||||
"administrator": "Administrateur",
|
||||
"administrator": "Administrateur'ice",
|
||||
"allowCommands": "Exécuter des commandes",
|
||||
"allowEdit": "Éditer, renommer et supprimer des fichiers ou des dossiers",
|
||||
"allowNew": "Créer de nouveaux fichiers et dossiers",
|
||||
"allowPublish": "Publier de nouveaux posts et pages",
|
||||
"allowSignup": "Autoriser les utilisateurs à s'inscrire",
|
||||
"allowSignup": "Autoriser les utilisateur'ices à s'inscrire",
|
||||
"hideLoginButton": "Cacher le bouton d’identification sur les pages publiques",
|
||||
"avoidChanges": "(Laisser vide pour conserver l'actuel)",
|
||||
"branding": "Image de marque",
|
||||
@@ -209,34 +209,34 @@
|
||||
"commandRunner": "Exécuteur de commandes",
|
||||
"commandRunnerHelp": "Ici, vous pouvez définir les commandes qui seront exécutées lors des événements nommés précédemments. Vous devez en écrire une par ligne. Les variables d'environnement {0} et {1} seront disponibles, {0} étant relatif à {1}. Pour plus d'informations sur cette fonctionnalité et les variables d'environnement disponibles, veuillez lire la {2}.",
|
||||
"commandsUpdated": "Commandes mises à jour !",
|
||||
"createUserDir": "Créer automatiquement un dossier pour l'utilisateur",
|
||||
"createUserDir": "Créer automatiquement un dossier pour l'utilisateur'ice",
|
||||
"minimumPasswordLength": "Taille minimale du mot de passe",
|
||||
"tusUploads": "Uploads segmentés",
|
||||
"tusUploadsHelp": "File Browser prend en charge les uploads segmentés afin de permettre une gestion efficace, fiable et reprenable sur des réseaux instables.",
|
||||
"tusUploadsChunkSize": "Taille maximale autorisée par segment (les uploads directs seront utilisés pour les fichiers plus petits). Vous pouvez entrer un entier en octets ou une chaîne telle que 10MB, 1GB, etc.",
|
||||
"tusUploadsRetryCount": "Nombre de tentatives en cas d'échec d'un segment.",
|
||||
"userHomeBasePath": "Chemin de base pour les dossiers personnels des utilisateurs",
|
||||
"userHomeBasePath": "Chemin de base pour les dossiers personnels des utilisateur'ices",
|
||||
"userScopeGenerationPlaceholder": "Le périmètre sera généré automatiquement",
|
||||
"createUserHomeDirectory": "Créer le dossier personnel de l'utilisateur",
|
||||
"createUserHomeDirectory": "Créer le dossier personnel de l'utilisateur'ice",
|
||||
"customStylesheet": "Feuille de style personnalisée",
|
||||
"defaultUserDescription": "Paramètres par défaut pour les nouveaux utilisateurs.",
|
||||
"defaultUserDescription": "Paramètres par défaut pour les nouveaux utilisateur'ices.",
|
||||
"disableExternalLinks": "Désactiver les liens externes (sauf la documentation)",
|
||||
"disableUsedDiskPercentage": "Désactiver le graphique de pourcentage d'utilisation du disque",
|
||||
"documentation": "documentation",
|
||||
"examples": "Exemples",
|
||||
"executeOnShell": "Exécuter dans le shell",
|
||||
"executeOnShellDescription": "Par défaut, File Browser exécute les commandes en appelant directement leurs binaires. Si vous voulez les exécuter sur un shell à la place (comme Bash ou PowerShell), vous pouvez le définir ici avec les arguments et les drapeaux requis. S'il est défini, la commande que vous exécutez sera ajoutée en tant qu'argument. Cela s'applique à la fois aux commandes utilisateur et aux crochets d'événements.",
|
||||
"globalRules": "Il s'agit d'un ensemble global de règles d'autorisation et d'interdiction. Elles s'appliquent à tous les utilisateurs. Vous pouvez définir des règles spécifiques sur les paramètres de chaque utilisateur pour remplacer celles-ci.",
|
||||
"executeOnShellDescription": "Par défaut, File Browser exécute les commandes en appelant directement leurs binaires. Si vous voulez les exécuter sur un shell à la place (comme Bash ou PowerShell), vous pouvez le définir ici avec les arguments et les drapeaux requis. S'il est défini, la commande que vous exécutez sera ajoutée en tant qu'argument. Cela s'applique à la fois aux commandes utilisateur'ice et aux crochets d'événements.",
|
||||
"globalRules": "Il s'agit d'un ensemble global de règles d'autorisation et d'interdiction. Elles s'appliquent à tous les utilisateur'ices. Vous pouvez définir des règles spécifiques sur les paramètres de chaque utilisateur'ice pour remplacer celles-ci.",
|
||||
"globalSettings": "Paramètres globaux",
|
||||
"hideDotfiles": "Cacher les fichiers de configuration commançant par un point",
|
||||
"insertPath": "Insérer le chemin",
|
||||
"insertRegex": "Insérer une expression régulière",
|
||||
"instanceName": "Nom de l'instance",
|
||||
"language": "Langue",
|
||||
"lockPassword": "Empêcher l'utilisateur de changer son mot de passe",
|
||||
"lockPassword": "Empêcher l'utilisateur'ice de changer son mot de passe",
|
||||
"newPassword": "Votre nouveau mot de passe",
|
||||
"newPasswordConfirm": "Confirmation du nouveau mot de passe",
|
||||
"newUser": "Nouvel utilisateur",
|
||||
"newUser": "Nouvel'le utilisateur'ice",
|
||||
"password": "Mot de passe",
|
||||
"passwordUpdated": "Mot de passe mis à jour !",
|
||||
"path": "Chemin",
|
||||
@@ -250,14 +250,14 @@
|
||||
"share": "Partager des fichiers (autorisation de téléchargement requise)"
|
||||
},
|
||||
"permissions": "Permissions",
|
||||
"permissionsHelp": "Vous pouvez définir l'utilisateur comme étant un administrateur ou encore choisir les permissions individuellement. Si vous sélectionnez \"Administrateur\", toutes les autres options seront automatiquement activées. La gestion des utilisateurs est un privilège que seul l'administrateur possède.\n",
|
||||
"permissionsHelp": "Vous pouvez définir l'utilisateur'ice comme étant un'e administrateur'ice ou encore choisir les permissions individuellement. Si vous sélectionnez \"Administrateur'ice\", toutes les autres options seront automatiquement activées. La gestion des utilisateur'ices est un privilège que seul l'administrateur'ice possède.\n",
|
||||
"profileSettings": "Paramètres du profil",
|
||||
"redirectAfterCopyMove": "Rediriger vers la destination après une copie/déplacement",
|
||||
"ruleExample1": "Bloque l'accès à tous les fichiers commençant par un point (comme par exemple .git, .gitignore) dans tous les dossiers.\n",
|
||||
"ruleExample2": "Bloque l'accès au fichier nommé \"Caddyfile\" à la racine du dossier utilisateur",
|
||||
"ruleExample2": "Bloque l'accès au fichier nommé \"Caddyfile\" à la racine du dossier utilisateur'ice",
|
||||
"rules": "Règles",
|
||||
"rulesHelp": "Vous pouvez définir ici un ensemble de règles pour cet utilisateur. Les fichiers bloqués ne seront pas affichés et ne seront pas accessibles par l'utilisateur. Les expressions régulières sont supportées et les chemins d'accès sont relatifs par rapport au dossier de l'utilisateur.\n",
|
||||
"scope": "Portée du dossier utilisateur",
|
||||
"rulesHelp": "Vous pouvez définir ici un ensemble de règles pour cet'te utilisateur'ice. Les fichiers bloqués ne seront pas affichés et ne seront pas accessibles par l'utilisateur'ice. Les expressions régulières sont supportées et les chemins d'accès sont relatifs par rapport au dossier de l'utilisateur'ice.\n",
|
||||
"scope": "Portée du dossier utilisateur'ice",
|
||||
"setDateFormat": "Définir le format de la date",
|
||||
"settingsUpdated": "Les paramètres ont été mis à jour !",
|
||||
"shareDuration": "Durée du partage",
|
||||
@@ -270,16 +270,16 @@
|
||||
"light": "Clair",
|
||||
"title": "Thème"
|
||||
},
|
||||
"user": "Utilisateur",
|
||||
"user": "Utilisateur'ice",
|
||||
"userCommands": "Commandes",
|
||||
"userCommandsHelp": "Une liste séparée par des espaces des commandes permises pour l'utilisateur. Exemple :\n",
|
||||
"userCreated": "Utilisateur créé !",
|
||||
"userDefaults": "Paramètres par défaut de l'utilisateur",
|
||||
"userDeleted": "Utilisateur supprimé !",
|
||||
"userManagement": "Gestion des utilisateurs",
|
||||
"userUpdated": "Utilisateur mis à jour !",
|
||||
"username": "Nom d'utilisateur",
|
||||
"users": "Utilisateurs",
|
||||
"userCreated": "Utilisateur'ice créé !",
|
||||
"userDefaults": "Paramètres par défaut de l'utilisateur'ice",
|
||||
"userDeleted": "Utilisateur'ice supprimé !",
|
||||
"userManagement": "Gestion des utilisateur'ices",
|
||||
"userUpdated": "Utilisateur'ice mis à jour !",
|
||||
"username": "Nom d'utilisateur'ice",
|
||||
"users": "Utilisateur'ices",
|
||||
"currentPassword": "Mot de Passe Actuel"
|
||||
},
|
||||
"sidebar": {
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
"rename": "이름 바꾸기",
|
||||
"replace": "대체",
|
||||
"reportIssue": "문제 보고",
|
||||
"resumeTransfer": "Resume previous transfer",
|
||||
"resumeTransferTooltip": "Skip all conflicting files, except the ones that are smaller on the server as we suppose that their transfert has been interrupted.",
|
||||
"resumeTransfer": "이전 전송을 재개",
|
||||
"resumeTransferTooltip": "서버에 있는 파일 중 전송이 중단되었을 가능성이 있는 작은 파일을 제외하고 충돌하는 모든 파일을 건너뜁니다.",
|
||||
"save": "저장",
|
||||
"schedule": "일정",
|
||||
"search": "검색",
|
||||
@@ -283,7 +283,7 @@
|
||||
"currentPassword": "현재 비밀번호"
|
||||
},
|
||||
"sidebar": {
|
||||
"diskUsed": "{used} of {total} used",
|
||||
"diskUsed": "{total} 중 {used} 사용",
|
||||
"help": "도움말",
|
||||
"hugoNew": "Hugo New",
|
||||
"login": "로그인",
|
||||
|
||||
@@ -238,7 +238,7 @@
|
||||
"newPasswordConfirm": "Confirmar a sua palavra-passe",
|
||||
"newUser": "Novo Utilizador",
|
||||
"password": "Palavra-passe",
|
||||
"passwordUpdated": "Palavras-passe não coincidem!",
|
||||
"passwordUpdated": "Palavra-passe atualizada!",
|
||||
"path": "Caminho",
|
||||
"perm": {
|
||||
"create": "Criar ficheiros e pastas",
|
||||
|
||||
@@ -1,309 +0,0 @@
|
||||
{
|
||||
"buttons": {
|
||||
"cancel": "Cancelar",
|
||||
"clear": "Limpar",
|
||||
"close": "Fechar",
|
||||
"continue": "Continuar",
|
||||
"copy": "Copiar",
|
||||
"copyFile": "Copiar ficheiro",
|
||||
"copyToClipboard": "Copiar",
|
||||
"copyDownloadLinkToClipboard": "Copy download link to clipboard",
|
||||
"create": "Criar",
|
||||
"delete": "Eliminar",
|
||||
"download": "Descarregar",
|
||||
"file": "File",
|
||||
"folder": "Folder",
|
||||
"fullScreen": "Toggle full screen",
|
||||
"hideDotfiles": "Hide dotfiles",
|
||||
"info": "Info",
|
||||
"more": "Mais",
|
||||
"move": "Mover",
|
||||
"moveFile": "Mover ficheiro",
|
||||
"new": "Novo",
|
||||
"next": "Próximo",
|
||||
"ok": "OK",
|
||||
"permalink": "Obter link permanente",
|
||||
"previous": "Anterior",
|
||||
"preview": "Preview",
|
||||
"publish": "Publicar",
|
||||
"rename": "Alterar nome",
|
||||
"replace": "Substituir",
|
||||
"reportIssue": "Reportar erro",
|
||||
"resumeTransfer": "Resume previous transfer",
|
||||
"resumeTransferTooltip": "Skip all conflicting files, except the ones that are smaller on the server as we suppose that their transfert has been interrupted.",
|
||||
"save": "Guardar",
|
||||
"schedule": "Agendar",
|
||||
"search": "Pesquisar",
|
||||
"select": "Selecionar",
|
||||
"selectMultiple": "Selecionar vários",
|
||||
"share": "Partilhar",
|
||||
"shell": "Alternar shell",
|
||||
"submit": "Submit",
|
||||
"switchView": "Alterar vista",
|
||||
"toggleSidebar": "Alternar barra lateral",
|
||||
"update": "Atualizar",
|
||||
"upload": "Enviar",
|
||||
"openFile": "Open file",
|
||||
"openDirect": "View raw",
|
||||
"discardChanges": "Discard",
|
||||
"stopSearch": "Stop searching",
|
||||
"saveChanges": "Save changes",
|
||||
"editAsText": "Edit as Text",
|
||||
"increaseFontSize": "Increase font size",
|
||||
"decreaseFontSize": "Decrease font size",
|
||||
"overrideAll": "Replace all files in destination folder",
|
||||
"skipAll": "Skip all conflicting files",
|
||||
"renameAll": "Rename all files (create a copy)",
|
||||
"singleDecision": "Decide for each conflicting file"
|
||||
},
|
||||
"download": {
|
||||
"downloadFile": "Descarregar ficheiro",
|
||||
"downloadFolder": "Descarregar pasta",
|
||||
"downloadSelected": "Download Selected"
|
||||
},
|
||||
"upload": {
|
||||
"abortUpload": "Are you sure you wish to abort?"
|
||||
},
|
||||
"errors": {
|
||||
"forbidden": "Não tem permissões para aceder a isto",
|
||||
"internal": "Algo correu bastante mal.",
|
||||
"notFound": "Esta localização não é alcançável.",
|
||||
"connection": "The server can't be reached."
|
||||
},
|
||||
"files": {
|
||||
"body": "Corpo",
|
||||
"closePreview": "Fechar pré-visualização",
|
||||
"files": "Ficheiros",
|
||||
"folders": "Pastas",
|
||||
"home": "Início",
|
||||
"lastModified": "Última alteração",
|
||||
"loading": "A carregar...",
|
||||
"lonely": "Sinto-me sozinho...",
|
||||
"metadata": "Metadados",
|
||||
"multipleSelectionEnabled": "Seleção múltipla ativada",
|
||||
"name": "Nome",
|
||||
"size": "Tamanho",
|
||||
"sortByLastModified": "Ordenar pela última alteração",
|
||||
"sortByName": "Ordenar pelo nome",
|
||||
"sortBySize": "Ordenar pelo tamanho",
|
||||
"noPreview": "Preview is not available for this file.",
|
||||
"csvTooLarge": "CSV file is too large for preview (>5MB). Please download to view.",
|
||||
"csvLoadFailed": "Failed to load CSV file.",
|
||||
"showingRows": "Showing {count} row(s)",
|
||||
"columnSeparator": "Column Separator",
|
||||
"csvSeparators": {
|
||||
"comma": "Comma (,)",
|
||||
"semicolon": "Semicolon (;)",
|
||||
"both": "Both (,) and (;)"
|
||||
},
|
||||
"fileEncoding": "File Encoding"
|
||||
},
|
||||
"help": {
|
||||
"click": "selecionar pasta ou ficheiro",
|
||||
"ctrl": {
|
||||
"click": "selecionar várias pastas e ficheiros",
|
||||
"f": "pesquisar",
|
||||
"s": "guardar um ficheiro ou descarrega a pasta em que está a navegar"
|
||||
},
|
||||
"del": "eliminar os ficheiros selecionados",
|
||||
"doubleClick": "abrir pasta ou ficheiro",
|
||||
"esc": "limpar seleção e/ou fechar menu",
|
||||
"f1": "esta informação",
|
||||
"f2": "alterar nome do ficheiro",
|
||||
"help": "Ajuda"
|
||||
},
|
||||
"login": {
|
||||
"createAnAccount": "Criar uma conta",
|
||||
"loginInstead": "Já tenho uma conta",
|
||||
"password": "Palavra-passe",
|
||||
"passwordConfirm": "Confirmação da palavra-passe",
|
||||
"passwordsDontMatch": "As palavras-passe não coincidem",
|
||||
"signup": "Registar",
|
||||
"submit": "Entrar na conta",
|
||||
"username": "Nome de utilizador",
|
||||
"usernameTaken": "O nome de utilizador já está registado",
|
||||
"wrongCredentials": "Dados errados",
|
||||
"passwordTooShort": "Password must be at least {min} characters",
|
||||
"logout_reasons": {
|
||||
"inactivity": "You have been logged out due to inactivity."
|
||||
}
|
||||
},
|
||||
"permanent": "Permanente",
|
||||
"prompts": {
|
||||
"copy": "Copiar",
|
||||
"copyMessage": "Escolha um lugar para onde copiar os ficheiros:",
|
||||
"currentlyNavigating": "A navegar em:",
|
||||
"deleteMessageMultiple": "Quer eliminar {count} ficheiro(s)?",
|
||||
"deleteMessageSingle": "Quer eliminar esta pasta/ficheiro?",
|
||||
"deleteMessageShare": "Are you sure you wish to delete this share({path})?",
|
||||
"deleteUser": "Are you sure you want to delete this user?",
|
||||
"deleteTitle": "Eliminar ficheiros",
|
||||
"displayName": "Nome:",
|
||||
"download": "Descarregar ficheiros",
|
||||
"downloadMessage": "Escolha o formato do ficheiro que quer descarregar.",
|
||||
"error": "Algo correu mal",
|
||||
"fileInfo": "Informação do ficheiro",
|
||||
"filesSelected": "{count} ficheiros selecionados.",
|
||||
"lastModified": "Última alteração",
|
||||
"move": "Mover",
|
||||
"moveMessage": "Escolha uma nova casa para os seus ficheiros/pastas:",
|
||||
"newArchetype": "Criar um novo post baseado num \"archetype\". O seu ficheiro será criado na pasta \"content\".",
|
||||
"newDir": "Nova pasta",
|
||||
"newDirMessage": "Escreva o nome da nova pasta.",
|
||||
"newFile": "Novo ficheiro",
|
||||
"newFileMessage": "Escreva o nome do novo ficheiro.",
|
||||
"numberDirs": "Número de pastas",
|
||||
"numberFiles": "Número de ficheiros",
|
||||
"rename": "Alterar nome",
|
||||
"renameMessage": "Insira um novo nome para",
|
||||
"replace": "Substituir",
|
||||
"replaceMessage": "Já existe um ficheiro com nome igual a um dos que está a tentar enviar. Quer substituí-lo?\n",
|
||||
"schedule": "Agendar",
|
||||
"scheduleMessage": "Escolha uma data para publicar este post.",
|
||||
"show": "Mostrar",
|
||||
"size": "Tamanho",
|
||||
"upload": "Upload",
|
||||
"uploadFiles": "Uploading {files} files...",
|
||||
"uploadMessage": "Select an option to upload.",
|
||||
"optionalPassword": "Optional password",
|
||||
"resolution": "Resolution",
|
||||
"discardEditorChanges": "Are you sure you wish to discard the changes you've made?",
|
||||
"replaceOrSkip": "Replace or skip files",
|
||||
"resolveConflict": "Which files do you want to keep?",
|
||||
"singleConflictResolve": "If you select both versions, a number will be added to the name of the copied file.",
|
||||
"fastConflictResolve": "The destination folder there are {count} files with same name.",
|
||||
"uploadingFiles": "Uploading files",
|
||||
"filesInOrigin": "Files in origin",
|
||||
"filesInDest": "Files in destination",
|
||||
"override": "Overwrite",
|
||||
"skip": "Skip",
|
||||
"forbiddenError": "Forbidden Error",
|
||||
"currentPassword": "Your password",
|
||||
"currentPasswordMessage": "Enter your password to validate this action."
|
||||
},
|
||||
"search": {
|
||||
"images": "Imagens",
|
||||
"music": "Música",
|
||||
"pdf": "PDF",
|
||||
"pressToSearch": "Tecla Enter para pesquisar...",
|
||||
"search": "Pesquisar...",
|
||||
"typeToSearch": "Escrever para pesquisar...",
|
||||
"types": "Tipos",
|
||||
"video": "Vídeos"
|
||||
},
|
||||
"settings": {
|
||||
"aceEditorTheme": "Ace editor theme",
|
||||
"admin": "Admin",
|
||||
"administrator": "Administrador",
|
||||
"allowCommands": "Executar comandos",
|
||||
"allowEdit": "Editar, renomear e eliminar ficheiros ou pastas",
|
||||
"allowNew": "Criar novos ficheiros e pastas",
|
||||
"allowPublish": "Publicar novas páginas e conteúdos",
|
||||
"allowSignup": "Permitir que os utilizadores criem contas",
|
||||
"hideLoginButton": "Hide the login button from public pages",
|
||||
"avoidChanges": "(deixe em branco para manter)",
|
||||
"branding": "Marca",
|
||||
"brandingDirectoryPath": "Caminho da pasta de marca",
|
||||
"brandingHelp": "Pode personalizar a aparência do seu Navegador de Ficheiros, alterar o nome, substituindo o logótipo, adicionando estilos personalizados e mesmo desativando links externos para o GitHub.\nPara mais informações sobre marca personalizada, por favor veja {0}.",
|
||||
"changePassword": "Alterar palavra-passe",
|
||||
"commandRunner": "Execução de comandos",
|
||||
"commandRunnerHelp": "Aqui pode definir comandos que são executados nos eventos nomeados. Tem de escrever um por linha. As variáveis de ambiente {0} e {1} estarão disponíveis, sendo {0} relativo a {1}. Para mais informações sobre esta funcionalidade e as variáveis de ambiente, veja {2}.",
|
||||
"commandsUpdated": "Comandos atualizados!",
|
||||
"createUserDir": "Criar automaticamente a pasta de início ao adicionar um novo utilizador",
|
||||
"minimumPasswordLength": "Minimum password length",
|
||||
"tusUploads": "Chunked Uploads",
|
||||
"tusUploadsHelp": "File Browser supports chunked file uploads, allowing for the creation of efficient, reliable, resumable and chunked file uploads even on unreliable networks.",
|
||||
"tusUploadsChunkSize": "Indicates to maximum size of a request (direct uploads will be used for smaller uploads). You may input a plain integer denoting byte size input or a string like 10MB, 1GB etc.",
|
||||
"tusUploadsRetryCount": "Number of retries to perform if a chunk fails to upload.",
|
||||
"userHomeBasePath": "Base path for user home directories",
|
||||
"userScopeGenerationPlaceholder": "The scope will be auto generated",
|
||||
"createUserHomeDirectory": "Create user home directory",
|
||||
"customStylesheet": "Folha de estilos personalizada",
|
||||
"defaultUserDescription": "Estas são as configurações padrão para novos utilizadores.",
|
||||
"disableExternalLinks": "Desativar links externos (exceto documentação)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentação",
|
||||
"examples": "Exemplos",
|
||||
"executeOnShell": "Executar na shell",
|
||||
"executeOnShellDescription": "Por padrão, o Navegador de Ficheiros executa os comandos chamando os seus binários diretamente. Se em vez disso, quiser executá-los numa shell (como Bash ou PowerShell), pode definir isso aqui com os argumentos e bandeiras necessários. Se definido, o comando que executa será anexado como um argumento. Isto aplica-se tanto a comandos do utilizador como a hooks de eventos.",
|
||||
"globalRules": "Isto é um conjunto global de regras de permissão e negação. Elas aplicam-se a todos os utilizadores. Pode especificar regras específicas para cada configuração do utilizador para sobreporem-se a estas.",
|
||||
"globalSettings": "Configurações globais",
|
||||
"hideDotfiles": "Hide dotfiles",
|
||||
"insertPath": "Inserir o caminho",
|
||||
"insertRegex": "Inserir expressão regular",
|
||||
"instanceName": "Nome da instância",
|
||||
"language": "Linguagem",
|
||||
"lockPassword": "Não permitir que o utilizador altere a palavra-passe",
|
||||
"newPassword": "Nova palavra-passe",
|
||||
"newPasswordConfirm": "Confirme a nova palavra-passe",
|
||||
"newUser": "Novo utilizador",
|
||||
"password": "Palavra-passe",
|
||||
"passwordUpdated": "Palavra-passe atualizada!",
|
||||
"path": "Path",
|
||||
"perm": {
|
||||
"create": "Criar ficheiros e pastas",
|
||||
"delete": "Eliminar ficheiros e pastas",
|
||||
"download": "Descarregar",
|
||||
"execute": "Executar comandos",
|
||||
"modify": "Editar ficheiros",
|
||||
"rename": "Alterar o nome ou mover ficheiros e pastas",
|
||||
"share": "Share files (require download permission)"
|
||||
},
|
||||
"permissions": "Permissões",
|
||||
"permissionsHelp": "Pode definir o utilizador como administrador ou escolher as permissões manualmente. Se selecionar a opção \"Administrador\", todas as outras opções serão automaticamente selecionadas. A gestão dos utilizadores é um privilégio restringido aos administradores.\n",
|
||||
"profileSettings": "Configurações do utilizador",
|
||||
"redirectAfterCopyMove": "Redirect to destination after copy/move",
|
||||
"ruleExample1": "previne o acesso a qualquer \"dotfile\" (como .git, .gitignore) em qualquer pasta\n",
|
||||
"ruleExample2": "bloqueia o acesso ao ficheiro chamado Caddyfile na raiz.",
|
||||
"rules": "Regras",
|
||||
"rulesHelp": "Aqui pode definir um conjunto de regras para permitir ou bloquear o acesso do utilizador a determinados ficheiros ou pastas. Os ficheiros bloqueados não irão aparecer durante a navegação. Suportamos expressões regulares e os caminhos dos ficheiros devem ser relativos à base do utilizador.\n",
|
||||
"scope": "Base",
|
||||
"setDateFormat": "Set exact date format",
|
||||
"settingsUpdated": "Configurações atualizadas!",
|
||||
"shareDuration": "Share Duration",
|
||||
"shareManagement": "Share Management",
|
||||
"shareDeleted": "Share deleted!",
|
||||
"singleClick": "Use single clicks to open files and directories",
|
||||
"themes": {
|
||||
"default": "System default",
|
||||
"dark": "Dark",
|
||||
"light": "Light",
|
||||
"title": "Theme"
|
||||
},
|
||||
"user": "Utilizador",
|
||||
"userCommands": "Comandos",
|
||||
"userCommandsHelp": "Uma lista, separada com espaços, de comandos disponíveis para este utilizados. Exemplo:",
|
||||
"userCreated": "Utilizador criado!",
|
||||
"userDefaults": "Configurações padrão do utilizador",
|
||||
"userDeleted": "Utilizador eliminado!",
|
||||
"userManagement": "Gestão de utilizadores",
|
||||
"userUpdated": "Utilizador atualizado!",
|
||||
"username": "Nome de utilizador",
|
||||
"users": "Utilizadores",
|
||||
"currentPassword": "Your Current Password"
|
||||
},
|
||||
"sidebar": {
|
||||
"diskUsed": "{used} of {total} used",
|
||||
"help": "Ajuda",
|
||||
"hugoNew": "Hugo New",
|
||||
"login": "Entrar",
|
||||
"logout": "Sair",
|
||||
"myFiles": "Meus ficheiros",
|
||||
"newFile": "Novo ficheiro",
|
||||
"newFolder": "Nova pasta",
|
||||
"preview": "Pré-visualizar",
|
||||
"settings": "Configurações",
|
||||
"signup": "Registar",
|
||||
"siteSettings": "Configurações do site"
|
||||
},
|
||||
"success": {
|
||||
"linkCopied": "Link copiado!"
|
||||
},
|
||||
"time": {
|
||||
"days": "Dias",
|
||||
"hours": "Horas",
|
||||
"minutes": "Minutos",
|
||||
"seconds": "Segundos",
|
||||
"unit": "Unidades de tempo"
|
||||
}
|
||||
}
|
||||
@@ -28,104 +28,104 @@
|
||||
"publish": "发布",
|
||||
"rename": "重命名",
|
||||
"replace": "替换",
|
||||
"reportIssue": "报告问题",
|
||||
"resumeTransfer": "Resume previous transfer",
|
||||
"resumeTransferTooltip": "Skip all conflicting files, except the ones that are smaller on the server as we suppose that their transfert has been interrupted.",
|
||||
"reportIssue": "反馈问题",
|
||||
"resumeTransfer": "恢复之前的传输任务",
|
||||
"resumeTransferTooltip": "跳过所有同名冲突文件;服务器端文件更小则判定为传输中断,保留该文件并继续传输。",
|
||||
"save": "保存",
|
||||
"schedule": "计划",
|
||||
"search": "搜索",
|
||||
"select": "选择",
|
||||
"selectMultiple": "选择多个",
|
||||
"selectMultiple": "多选",
|
||||
"share": "分享",
|
||||
"shell": "激活 Shell",
|
||||
"shell": "切换终端",
|
||||
"submit": "提交",
|
||||
"switchView": "切换显示方式",
|
||||
"switchView": "切换视图",
|
||||
"toggleSidebar": "切换侧边栏",
|
||||
"update": "更新",
|
||||
"upload": "上传",
|
||||
"openFile": "打开文件",
|
||||
"openDirect": "View raw",
|
||||
"discardChanges": "放弃更改",
|
||||
"openDirect": "查看原始内容",
|
||||
"discardChanges": "放弃",
|
||||
"stopSearch": "停止搜索",
|
||||
"saveChanges": "保存更改",
|
||||
"editAsText": "以文本形式编辑",
|
||||
"increaseFontSize": "增大字体大小",
|
||||
"decreaseFontSize": "减小字体大小",
|
||||
"overrideAll": "Replace all files in destination folder",
|
||||
"skipAll": "Skip all conflicting files",
|
||||
"renameAll": "Rename all files (create a copy)",
|
||||
"singleDecision": "Decide for each conflicting file"
|
||||
"editAsText": "以文本模式编辑",
|
||||
"increaseFontSize": "放大字体",
|
||||
"decreaseFontSize": "缩小字体",
|
||||
"overrideAll": "替换目标文件夹中的所有文件",
|
||||
"skipAll": "跳过所有冲突文件",
|
||||
"renameAll": "全部重命名(创建副本)",
|
||||
"singleDecision": "逐个处理冲突文件"
|
||||
},
|
||||
"download": {
|
||||
"downloadFile": "下载文件",
|
||||
"downloadFolder": "下载文件夹",
|
||||
"downloadSelected": "下载已选"
|
||||
"downloadSelected": "下载选中项"
|
||||
},
|
||||
"upload": {
|
||||
"abortUpload": "你确定要中止吗?"
|
||||
},
|
||||
"errors": {
|
||||
"forbidden": "你无权限访问",
|
||||
"internal": "服务器出了点问题。",
|
||||
"notFound": "找不到文件。",
|
||||
"connection": "无法连接到服务器。"
|
||||
"forbidden": "权限不足,拒绝访问",
|
||||
"internal": "服务器内部错误",
|
||||
"notFound": "该位置无法访问。",
|
||||
"connection": "无法连接服务器"
|
||||
},
|
||||
"files": {
|
||||
"body": "内容",
|
||||
"closePreview": "关闭预览",
|
||||
"files": "文件",
|
||||
"folders": "文件夹",
|
||||
"home": "主页",
|
||||
"lastModified": "最后修改",
|
||||
"home": "首页",
|
||||
"lastModified": "修改时间",
|
||||
"loading": "加载中...",
|
||||
"lonely": "这里没有任何文件...",
|
||||
"lonely": "暂无任何文件...",
|
||||
"metadata": "元数据",
|
||||
"multipleSelectionEnabled": "多选模式已开启",
|
||||
"multipleSelectionEnabled": "已开启多选模式",
|
||||
"name": "名称",
|
||||
"size": "大小",
|
||||
"sortByLastModified": "按最后修改时间排序",
|
||||
"sortByLastModified": "按修改时间排序",
|
||||
"sortByName": "按名称排序",
|
||||
"sortBySize": "按大小排序",
|
||||
"noPreview": "此文件无法预览。",
|
||||
"csvTooLarge": "CSV文件大到无法预览(>5MB)。请下载查看。",
|
||||
"csvLoadFailed": "加载 CSV 文件失败。",
|
||||
"showingRows": "正在显示 {count} 行",
|
||||
"noPreview": "该文件暂不支持预览",
|
||||
"csvTooLarge": "CSV 文件过大(>5MB),无法预览,请下载后查看",
|
||||
"csvLoadFailed": "CSV 文件加载失败",
|
||||
"showingRows": "当前显示 {count} 行数据",
|
||||
"columnSeparator": "列分隔符",
|
||||
"csvSeparators": {
|
||||
"comma": "逗号 (,)",
|
||||
"semicolon": "分号 (;)",
|
||||
"both": "逗号 (,) 和分号 (;)"
|
||||
},
|
||||
"fileEncoding": "File Encoding"
|
||||
"fileEncoding": "文件编码"
|
||||
},
|
||||
"help": {
|
||||
"click": "选择文件或文件夹",
|
||||
"click": "选中文件或文件夹",
|
||||
"ctrl": {
|
||||
"click": "选择多个文件或文件夹",
|
||||
"click": "多选文件或文件夹",
|
||||
"f": "打开搜索框",
|
||||
"s": "保存文件或下载当前文件夹"
|
||||
},
|
||||
"del": "删除所选的文件/文件夹",
|
||||
"doubleClick": "打开文件/文件夹",
|
||||
"esc": "清除已选项或关闭提示信息",
|
||||
"f1": "显示该帮助信息",
|
||||
"f2": "重命名文件/文件夹",
|
||||
"esc": "取消选中或关闭提示框",
|
||||
"f1": "打开帮助",
|
||||
"f2": "重命名文件",
|
||||
"help": "帮助"
|
||||
},
|
||||
"login": {
|
||||
"createAnAccount": "创建用户",
|
||||
"loginInstead": "已有用户登录",
|
||||
"createAnAccount": "注册账号",
|
||||
"loginInstead": "已有账号",
|
||||
"password": "密码",
|
||||
"passwordConfirm": "确认密码",
|
||||
"passwordsDontMatch": "密码不一致",
|
||||
"passwordsDontMatch": "两次输入的密码不一致",
|
||||
"signup": "注册",
|
||||
"submit": "登录",
|
||||
"username": "用户名",
|
||||
"usernameTaken": "用户名已经被使用",
|
||||
"wrongCredentials": "用户名或密码错误",
|
||||
"passwordTooShort": "密码必须至少包含 {min} 个字符",
|
||||
"passwordTooShort": "密码长度至少为 {min} 位字符",
|
||||
"logout_reasons": {
|
||||
"inactivity": "由于未活动,您已登出。"
|
||||
"inactivity": "因长时间未操作,系统已自动登出."
|
||||
}
|
||||
},
|
||||
"permanent": "永久",
|
||||
@@ -136,58 +136,58 @@
|
||||
"deleteMessageMultiple": "你确定要删除这 {count} 个文件吗?",
|
||||
"deleteMessageSingle": "你确定要删除这个文件/文件夹吗?",
|
||||
"deleteMessageShare": "你确定要删除这个分享({path})吗?",
|
||||
"deleteUser": "你确定要删除这个用户吗?",
|
||||
"deleteUser": "确定要删除该用户吗?",
|
||||
"deleteTitle": "删除文件",
|
||||
"displayName": "名称:",
|
||||
"download": "下载文件",
|
||||
"downloadMessage": "请选择要下载的压缩格式。",
|
||||
"error": "出了一点问题...",
|
||||
"downloadMessage": "请选择要下载的压缩包格式。",
|
||||
"error": "出现未知错误...",
|
||||
"fileInfo": "文件信息",
|
||||
"filesSelected": "已选择 {count} 个文件。",
|
||||
"lastModified": "最后修改",
|
||||
"filesSelected": "已选中 {count} 个文件",
|
||||
"lastModified": "修改时间",
|
||||
"move": "移动",
|
||||
"moveMessage": "请选择目标目录:",
|
||||
"newArchetype": "创建一个基于原型的新帖子。你的文件将会创建在内容文件夹中。",
|
||||
"newArchetype": "基于模板新建文档,文件将创建在内容目录中。",
|
||||
"newDir": "新建文件夹",
|
||||
"newDirMessage": "请输入新文件夹的名称。",
|
||||
"newFile": "新建文件",
|
||||
"newFileMessage": "请输入新文件的名称。",
|
||||
"numberDirs": "文件夹数",
|
||||
"numberFiles": "文件数",
|
||||
"numberDirs": "文件夹数量",
|
||||
"numberFiles": "文件数量",
|
||||
"rename": "重命名",
|
||||
"renameMessage": "请输入新名称,旧名称为:",
|
||||
"renameMessage": "请输入新名称",
|
||||
"replace": "替换",
|
||||
"replaceMessage": "你尝试上传的文件中有一个与现有文件的名称存在冲突。是否替换现有的同名文件?\n",
|
||||
"replaceMessage": "你上传的文件与已有文件重名,是否跳过该文件继续上传,或是替换原有文件?\n",
|
||||
"schedule": "计划",
|
||||
"scheduleMessage": "请选择发布这篇帖子的日期与时间。",
|
||||
"show": "点击以显示",
|
||||
"scheduleMessage": "请选择文档发布的日期和时间",
|
||||
"show": "显示",
|
||||
"size": "大小",
|
||||
"upload": "上传",
|
||||
"uploadFiles": "正在上传 {files} ...",
|
||||
"uploadMessage": "选择上传选项。",
|
||||
"optionalPassword": "密码(选填,不填即无密码)",
|
||||
"uploadMessage": "请选择上传选项",
|
||||
"optionalPassword": "密码(选填,留空则无需密码)",
|
||||
"resolution": "分辨率",
|
||||
"discardEditorChanges": "你确定要放弃所做的更改吗?",
|
||||
"replaceOrSkip": "Replace or skip files",
|
||||
"resolveConflict": "Which files do you want to keep?",
|
||||
"singleConflictResolve": "If you select both versions, a number will be added to the name of the copied file.",
|
||||
"fastConflictResolve": "The destination folder there are {count} files with same name.",
|
||||
"uploadingFiles": "Uploading files",
|
||||
"filesInOrigin": "Files in origin",
|
||||
"filesInDest": "Files in destination",
|
||||
"override": "Overwrite",
|
||||
"skip": "Skip",
|
||||
"forbiddenError": "Forbidden Error",
|
||||
"currentPassword": "Your password",
|
||||
"currentPasswordMessage": "Enter your password to validate this action."
|
||||
"discardEditorChanges": "是否放弃已修改的内容?",
|
||||
"replaceOrSkip": "替换或跳过文件",
|
||||
"resolveConflict": "保留哪些文件?",
|
||||
"singleConflictResolve": "若同时保留两个版本,复制的文件会自动追加序号。",
|
||||
"fastConflictResolve": "目标目录内存在 {count} 个同名文件",
|
||||
"uploadingFiles": "正在上传文件",
|
||||
"filesInOrigin": "源文件",
|
||||
"filesInDest": "目标文件",
|
||||
"override": "覆盖",
|
||||
"skip": "跳过",
|
||||
"forbiddenError": "权限错误",
|
||||
"currentPassword": "当前密码",
|
||||
"currentPasswordMessage": "请输入当前密码以验证操作"
|
||||
},
|
||||
"search": {
|
||||
"images": "图像",
|
||||
"music": "音乐",
|
||||
"pdf": "PDF",
|
||||
"pressToSearch": "按回车以搜索...",
|
||||
"pressToSearch": "按下回车开始搜索...",
|
||||
"search": "搜索...",
|
||||
"typeToSearch": "输入以搜索...",
|
||||
"typeToSearch": "输入内容进行搜索...",
|
||||
"types": "类型",
|
||||
"video": "视频"
|
||||
},
|
||||
@@ -195,47 +195,47 @@
|
||||
"aceEditorTheme": "Ace编辑器主题",
|
||||
"admin": "管理员",
|
||||
"administrator": "管理员",
|
||||
"allowCommands": "执行命令(Shell 命令)",
|
||||
"allowCommands": "允许执行终端命令",
|
||||
"allowEdit": "编辑、重命名或删除文件/文件夹",
|
||||
"allowNew": "创建新文件和文件夹",
|
||||
"allowPublish": "发布新的帖子与页面",
|
||||
"allowSignup": "允许用户注册",
|
||||
"hideLoginButton": "从公开页面隐藏登录按钮",
|
||||
"avoidChanges": "(留空以避免更改)",
|
||||
"avoidChanges": "(留空则不修改)",
|
||||
"branding": "品牌",
|
||||
"brandingDirectoryPath": "品牌信息文件夹路径",
|
||||
"brandingHelp": "你可以通过改变实例名称,更换 Logo,加入自定义样式,甚至禁用到 Github 的外部链接来自定义 File Browser 的外观和感觉。\n想获得更多信息,请查看 {0}。",
|
||||
"brandingDirectoryPath": "品牌资源目录路径",
|
||||
"brandingHelp": "你可以修改站点名称、更换Logo、添加自定义样式,也可以禁用外部GitHub链接,来自定义本文件管理器界面。\n详情请查看 {0}。",
|
||||
"changePassword": "更改密码",
|
||||
"commandRunner": "命令执行器",
|
||||
"commandRunnerHelp": "你可以在此设置在下列事件中执行的命令。每行必须写一条命令。可以在命令中使用环境变量 {0} 和 {1},使 {0} 与 {1} 相关联。关于此功能和可用环境变量的更多信息,请阅读 {2}。",
|
||||
"commandRunnerHelp": "在此设置事件触发命令,单行单条。环境变量 {0}、{1} 可用,{0} 相对 {1} 生效。功能与变量详情请参考 {2}。",
|
||||
"commandsUpdated": "命令已更新!",
|
||||
"createUserDir": "在添加新用户的同时自动创建用户的主目录",
|
||||
"createUserDir": "新增用户时自动创建用户主目录",
|
||||
"minimumPasswordLength": "最小密码长度",
|
||||
"tusUploads": "分块上传",
|
||||
"tusUploadsHelp": "File Browser 支持分块上传,在不佳的网络下也可进行高效、可靠、可续的文件上传",
|
||||
"tusUploadsChunkSize": "分块上传大小,例如 10MB 或 1GB",
|
||||
"tusUploadsHelp": "支持文件分片上传,网络不佳时仍可稳定传输,并支持断点续传。",
|
||||
"tusUploadsChunkSize": "分块大小(例如:10MB、1GB);小于该值的文件将直接上传。",
|
||||
"tusUploadsRetryCount": "分块上传失败时的重试次数",
|
||||
"userHomeBasePath": "用户主目录的路径",
|
||||
"userScopeGenerationPlaceholder": "自动生成目录范围",
|
||||
"createUserHomeDirectory": "创建用户主目录",
|
||||
"customStylesheet": "自定义样式表(CSS)",
|
||||
"defaultUserDescription": "这些是新用户的默认设置。",
|
||||
"customStylesheet": "自定义样式表",
|
||||
"defaultUserDescription": "以下为新用户的默认配置",
|
||||
"disableExternalLinks": "禁止外部链接(帮助文档除外)",
|
||||
"disableUsedDiskPercentage": "禁用磁盘已用空间展示",
|
||||
"documentation": "帮助文档",
|
||||
"examples": "示例",
|
||||
"executeOnShell": "在 Shell 中执行",
|
||||
"executeOnShellDescription": "默认情况下,File Browser 通过直接调用命令的二进制包来执行命令,如果想在 Shell中 执行(如 Bash 或 PowerShell),你可以在这里定义所使用的 Shell 和参数。设置后,你所执行的命令会作为参数追加。本设置对用户命令和事件钩子都生效。",
|
||||
"globalRules": "这是全局允许与禁止规则。它们作用于所有用户。你可以给每个用户定义单独的特殊规则来覆盖全局规则。",
|
||||
"executeOnShell": "通过终端执行",
|
||||
"executeOnShellDescription": "默认直接调用程序执行命令。如需通过终端运行(如Bash、PowerShell 等),可在此配置解释器、参数及选项,执行命令将自动作为参数传入。本设置对用户命令和事件钩子均生效。",
|
||||
"globalRules": "全局访问规则,对所有用户生效。也可单独为用户设置规则来覆盖全局规则。",
|
||||
"globalSettings": "全局设置",
|
||||
"hideDotfiles": "不显示隐藏文件",
|
||||
"insertPath": "插入路径",
|
||||
"insertRegex": "插入正则表达式",
|
||||
"instanceName": "实例名称",
|
||||
"instanceName": "站点名称",
|
||||
"language": "语言",
|
||||
"lockPassword": "禁止用户修改密码",
|
||||
"newPassword": "你的新密码",
|
||||
"newPasswordConfirm": "再次输入以确认你的新密码",
|
||||
"newPassword": "新密码",
|
||||
"newPasswordConfirm": "再次输入新密码",
|
||||
"newUser": "新建用户",
|
||||
"password": "密码",
|
||||
"passwordUpdated": "密码已更新!",
|
||||
@@ -247,23 +247,23 @@
|
||||
"execute": "执行命令",
|
||||
"modify": "编辑",
|
||||
"rename": "重命名或移动文件和文件夹",
|
||||
"share": "Share files (require download permission)"
|
||||
"share": "分享文件(需开启下载权限)"
|
||||
},
|
||||
"permissions": "权限",
|
||||
"permissionsHelp": "你可以将该用户设置为管理员或单独选择各项权限。如果你选择了“管理员”,则其他的选项会被自动选中,同时该用户可以管理其他用户。\n",
|
||||
"profileSettings": "个人设置",
|
||||
"redirectAfterCopyMove": "复制/移动后转到目标位置",
|
||||
"ruleExample1": "阻止用户访问所有文件夹下任何以 . 开头的文件(隐藏文件, 例如: .git, .gitignore)。\n",
|
||||
"ruleExample2": "阻止用户访问其目录范围的根目录下名为 Caddyfile 的文件。",
|
||||
"ruleExample1": "禁止用户访问所有目录下以 . 开头的隐藏文件(隐藏文件, 例如: .git, .gitignore)。\n",
|
||||
"ruleExample2": "禁止用户访问个人根目录下的 Caddyfile 文件。",
|
||||
"rules": "规则",
|
||||
"rulesHelp": "你可以为该用户制定一组黑名单或白名单式的规则,被屏蔽的文件将不会显示在列表中,用户也无权限访问,支持正则表达式和相对于用户范围的路径。\n",
|
||||
"rulesHelp": "可为用户配置黑白名单规则,被限制的文件将隐藏且无法访问。支持正则表达式、相对用户目录的路径写法。\n",
|
||||
"scope": "目录范围",
|
||||
"setDateFormat": "显示精确的日期格式",
|
||||
"settingsUpdated": "设置已更新!",
|
||||
"shareDuration": "分享期限",
|
||||
"shareManagement": "分享管理",
|
||||
"shareDeleted": "分享已删除!",
|
||||
"singleClick": "使用单击来打开文件和文件夹",
|
||||
"singleClick": "单击打开文件/文件夹",
|
||||
"themes": {
|
||||
"default": "系统默认",
|
||||
"dark": "深色",
|
||||
@@ -271,30 +271,30 @@
|
||||
"title": "主题"
|
||||
},
|
||||
"user": "用户",
|
||||
"userCommands": "用户命令(Shell 命令)",
|
||||
"userCommandsHelp": "指定该用户可以执行的命令(Shell 命令),用空格分隔。例如:\n",
|
||||
"userCommands": "可用终端命令",
|
||||
"userCommandsHelp": "指定该用户可执行的终端命令,多个命令用空格分隔。示例:\n",
|
||||
"userCreated": "用户已创建!",
|
||||
"userDefaults": "用户默认设置",
|
||||
"userDeleted": "用户已删除!",
|
||||
"userManagement": "用户管理",
|
||||
"userUpdated": "用户已更新!",
|
||||
"userUpdated": "用户信息已更新!",
|
||||
"username": "用户名",
|
||||
"users": "用户",
|
||||
"currentPassword": "您当前的密码"
|
||||
"currentPassword": "当前密码"
|
||||
},
|
||||
"sidebar": {
|
||||
"diskUsed": "{used} of {total} used",
|
||||
"diskUsed": "已使用 {used} / 总容量 {total}",
|
||||
"help": "帮助",
|
||||
"hugoNew": "Hugo 新建",
|
||||
"login": "登录",
|
||||
"logout": "登出",
|
||||
"logout": "退出",
|
||||
"myFiles": "我的文件",
|
||||
"newFile": "新建文件",
|
||||
"newFolder": "新建文件夹",
|
||||
"preview": "预览",
|
||||
"settings": "设置",
|
||||
"signup": "注册",
|
||||
"siteSettings": "网站设置"
|
||||
"siteSettings": "站点设置"
|
||||
},
|
||||
"success": {
|
||||
"linkCopied": "链接已复制!"
|
||||
|
||||
@@ -180,7 +180,7 @@ const router = createRouter({
|
||||
routes,
|
||||
});
|
||||
|
||||
router.beforeResolve(async (to, from, next) => {
|
||||
router.beforeResolve(async (to, from) => {
|
||||
const title = i18n.global.t(titles[to.name as keyof typeof titles]);
|
||||
document.title = title + " - " + name;
|
||||
|
||||
@@ -196,29 +196,25 @@ router.beforeResolve(async (to, from, next) => {
|
||||
}
|
||||
|
||||
if (to.path.endsWith("/login") && authStore.isLoggedIn) {
|
||||
next({ path: "/files/" });
|
||||
return;
|
||||
return { path: "/files/" };
|
||||
}
|
||||
|
||||
if (to.matched.some((record) => record.meta.requiresAuth)) {
|
||||
if (!authStore.isLoggedIn) {
|
||||
next({
|
||||
return {
|
||||
path: "/login",
|
||||
query: { redirect: to.fullPath },
|
||||
});
|
||||
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
if (to.matched.some((record) => record.meta.requiresAdmin)) {
|
||||
if (authStore.user === null || !authStore.user.perm.admin) {
|
||||
next({ path: "/403" });
|
||||
return;
|
||||
return { path: "/403" };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
return;
|
||||
});
|
||||
|
||||
export { router, router as default };
|
||||
Vendored
+1
-1
@@ -25,7 +25,7 @@ interface Share {
|
||||
path: string;
|
||||
expire?: any;
|
||||
userID?: number;
|
||||
token?: string;
|
||||
hasPassword?: boolean;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { files as api } from "@/api";
|
||||
|
||||
vi.mock("@/api", () => ({
|
||||
files: {
|
||||
fetch: vi.fn(),
|
||||
fetchAll: vi.fn(),
|
||||
},
|
||||
}));
|
||||
@@ -19,8 +20,8 @@ vi.mock("@/stores/layout", () => ({ useLayoutStore: vi.fn() }));
|
||||
vi.mock("@/stores/upload", () => ({ useUploadStore: vi.fn() }));
|
||||
vi.mock("@/utils/url", () => ({ default: {} }));
|
||||
|
||||
// A move/copy/drag item carries `name` (raw) and `to` (URL-encoded) but no
|
||||
// `fullPath` — mirroring what Move.vue / Copy.vue / ListingItem.vue build.
|
||||
// A move/copy/drag item carries name (raw) and to (URL-encoded) but no
|
||||
// fullPath - mirroring what Move.vue / Copy.vue / ListingItem.vue build.
|
||||
function moveItem(name: string, dest: string, size = 12) {
|
||||
return {
|
||||
from: `/files/source/${encodeURIComponent(name)}`,
|
||||
@@ -167,29 +168,46 @@ describe("checkConflict", () => {
|
||||
expect(conflicts[0].name).toBe("/target/folder/deep/file.txt");
|
||||
});
|
||||
|
||||
// Copy/move stats the whole destination, so a same-named directory is a
|
||||
// conflict in its own right (regression for the directory case of #5957).
|
||||
it("reports a directory conflict for copy/move (includeDirectories)", async () => {
|
||||
vi.mocked(api.fetchAll).mockResolvedValue([
|
||||
{
|
||||
path: "/target/folder",
|
||||
name: "folder",
|
||||
size: 0,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: true,
|
||||
},
|
||||
]);
|
||||
// Copy/move only needs the target directory's direct children. A recursive
|
||||
// walk can make the UI look frozen on large destinations (regression #6005).
|
||||
it("checks only the direct destination listing for copy/move", async () => {
|
||||
vi.mocked(api.fetch).mockResolvedValue({
|
||||
items: [
|
||||
{
|
||||
path: "/target/file.txt",
|
||||
name: "file.txt",
|
||||
size: 10,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: false,
|
||||
},
|
||||
{
|
||||
path: "/target/folder",
|
||||
name: "folder",
|
||||
size: 0,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: true,
|
||||
},
|
||||
],
|
||||
} as Resource);
|
||||
|
||||
const items = [{ ...moveItem("folder", "/files/target/", 0), isDir: true }];
|
||||
const items = [
|
||||
moveItem("file.txt", "/files/target/"),
|
||||
{ ...moveItem("folder", "/files/target/", 0), isDir: true },
|
||||
];
|
||||
|
||||
const conflicts = await checkConflict(items, "/files/target/", true);
|
||||
|
||||
expect(conflicts).toHaveLength(1);
|
||||
expect(conflicts[0].name).toBe("/target/folder");
|
||||
expect(api.fetch).toHaveBeenCalledWith("/files/target/");
|
||||
expect(api.fetchAll).not.toHaveBeenCalled();
|
||||
expect(conflicts).toHaveLength(2);
|
||||
expect(conflicts.map((conflict) => conflict.name)).toEqual([
|
||||
"/target/file.txt",
|
||||
"/target/folder",
|
||||
]);
|
||||
});
|
||||
|
||||
// Uploads merge into an existing folder, so the directory itself must not be
|
||||
// reported — only the files inside it can conflict.
|
||||
// reported - only the files inside it can conflict.
|
||||
it("ignores a directory conflict for uploads (default)", async () => {
|
||||
vi.mocked(api.fetchAll).mockResolvedValue([
|
||||
{
|
||||
@@ -220,4 +238,150 @@ describe("checkConflict", () => {
|
||||
|
||||
expect(conflicts).toHaveLength(0);
|
||||
});
|
||||
|
||||
// Regression for #5980: a FileBrowser server running on Windows returns
|
||||
// backslash-separated paths from the recursive listing. Without normalizing
|
||||
// them, the prefix strip and key lookup never match, so the conflict modal is
|
||||
// skipped and the backend returns a bare 409.
|
||||
it("detects a conflict for backslash-separated server paths (Windows)", async () => {
|
||||
vi.mocked(api.fetchAll).mockResolvedValue([
|
||||
{
|
||||
path: "\\target\\file.txt",
|
||||
name: "file.txt",
|
||||
size: 10,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: false,
|
||||
},
|
||||
]);
|
||||
|
||||
const conflicts = await checkConflict(
|
||||
[moveItem("file.txt", "/files/target/")],
|
||||
"/files/target/"
|
||||
);
|
||||
|
||||
expect(conflicts).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("detects nested conflicts for backslash-separated server paths (Windows)", async () => {
|
||||
vi.mocked(api.fetchAll).mockResolvedValue([
|
||||
{
|
||||
path: "\\target\\folder\\nested file.txt",
|
||||
name: "nested file.txt",
|
||||
size: 10,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: false,
|
||||
},
|
||||
]);
|
||||
|
||||
const files = [
|
||||
{
|
||||
name: "nested file.txt",
|
||||
size: 12,
|
||||
isDir: false,
|
||||
fullPath: "folder/nested file.txt",
|
||||
},
|
||||
];
|
||||
|
||||
const conflicts = await checkConflict(files, "/files/target/");
|
||||
|
||||
expect(conflicts).toHaveLength(1);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["forward slashes", "/target/My SubDir/file.txt"],
|
||||
["Windows backslashes", "\\target\\My SubDir\\file.txt"],
|
||||
])(
|
||||
"detects conflicts below an encoded destination path with %s",
|
||||
async (_label, serverPath) => {
|
||||
vi.mocked(api.fetchAll).mockResolvedValue([
|
||||
{
|
||||
path: serverPath,
|
||||
name: "file.txt",
|
||||
size: 10,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: false,
|
||||
},
|
||||
]);
|
||||
|
||||
const conflicts = await checkConflict(
|
||||
[moveItem("file.txt", "/files/target/My%20SubDir/")],
|
||||
"/files/target/My%20SubDir/"
|
||||
);
|
||||
|
||||
expect(conflicts).toHaveLength(1);
|
||||
expect(conflicts[0].name).toBe("/target/My SubDir/file.txt");
|
||||
}
|
||||
);
|
||||
|
||||
it("detects nested folder-upload conflicts below an encoded destination path", async () => {
|
||||
vi.mocked(api.fetchAll).mockResolvedValue([
|
||||
{
|
||||
path: "\\target\\My SubDir\\folder\\nested file.txt",
|
||||
name: "nested file.txt",
|
||||
size: 10,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: false,
|
||||
},
|
||||
]);
|
||||
|
||||
const conflicts = await checkConflict(
|
||||
[
|
||||
{
|
||||
name: "nested file.txt",
|
||||
size: 12,
|
||||
isDir: false,
|
||||
fullPath: "folder/nested file.txt",
|
||||
},
|
||||
],
|
||||
"/files/target/My%20SubDir/"
|
||||
);
|
||||
|
||||
expect(conflicts).toHaveLength(1);
|
||||
expect(conflicts[0].name).toBe("/target/My SubDir/folder/nested file.txt");
|
||||
});
|
||||
|
||||
it("leaves malformed destination path segments unchanged", async () => {
|
||||
vi.mocked(api.fetchAll).mockResolvedValue([
|
||||
{
|
||||
path: "/target/bad%ZZ/file.txt",
|
||||
name: "file.txt",
|
||||
size: 10,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: false,
|
||||
},
|
||||
]);
|
||||
|
||||
const conflicts = await checkConflict(
|
||||
[moveItem("file.txt", "/files/target/bad%ZZ/")],
|
||||
"/files/target/bad%ZZ/"
|
||||
);
|
||||
|
||||
expect(conflicts).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("does not match files outside the decoded destination path", async () => {
|
||||
vi.mocked(api.fetchAll).mockResolvedValue([
|
||||
{
|
||||
path: "/target/My SubDir/other.txt",
|
||||
name: "other.txt",
|
||||
size: 10,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: false,
|
||||
},
|
||||
{
|
||||
path: "/target/My Other SubDir/file.txt",
|
||||
name: "file.txt",
|
||||
size: 10,
|
||||
modified: "2026-06-04T00:00:00Z",
|
||||
isDir: false,
|
||||
},
|
||||
]);
|
||||
|
||||
const conflicts = await checkConflict(
|
||||
[moveItem("file.txt", "/files/target/My%20SubDir/")],
|
||||
"/files/target/My%20SubDir/"
|
||||
);
|
||||
|
||||
expect(conflicts).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
@@ -21,20 +21,74 @@ function conflictKey(item: UploadEntry): string {
|
||||
return (item.fullPath || item.name).replace(/^\/+/, "");
|
||||
}
|
||||
|
||||
type ServerConflictEntry = {
|
||||
path: string;
|
||||
name: string;
|
||||
size: number;
|
||||
modified: string;
|
||||
};
|
||||
|
||||
async function fetchConflictEntries(
|
||||
basePath: string,
|
||||
includeDirectories: boolean
|
||||
): Promise<ServerConflictEntry[]> {
|
||||
if (!includeDirectories) {
|
||||
return await api.fetchAll(basePath);
|
||||
}
|
||||
|
||||
const destination = await api.fetch(basePath);
|
||||
return destination.items ?? [];
|
||||
}
|
||||
|
||||
function conflictPath(entry: ServerConflictEntry): string {
|
||||
return entry.path.replace(/\\/g, "/");
|
||||
}
|
||||
|
||||
function decodePath(path: string): string {
|
||||
return path
|
||||
.split("/")
|
||||
.map((segment) => {
|
||||
try {
|
||||
return decodeURIComponent(segment);
|
||||
} catch {
|
||||
return segment;
|
||||
}
|
||||
})
|
||||
.join("/");
|
||||
}
|
||||
|
||||
function buildConflictMap(
|
||||
serverEntries: ServerConflictEntry[],
|
||||
basePath: string,
|
||||
includeDirectories: boolean
|
||||
): Map<string, ServerConflictEntry> {
|
||||
const serverMap = new Map<string, ServerConflictEntry>();
|
||||
const normBase = decodePath(removePrefix(basePath)).replace(/\/+$/, "");
|
||||
for (const entry of serverEntries) {
|
||||
// A Windows server may return OS-native backslash separators; normalize to
|
||||
// forward slashes so the prefix strip and key lookup line up.
|
||||
const path = conflictPath(entry);
|
||||
const key = includeDirectories
|
||||
? entry.name
|
||||
: path.startsWith(normBase)
|
||||
? path.slice(normBase.length)
|
||||
: path;
|
||||
serverMap.set(key.replace(/^\/+/, ""), entry);
|
||||
}
|
||||
|
||||
return serverMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entries from `files` that already exist under `basePath` on the
|
||||
* server, so the caller can prompt the user to overwrite/rename/skip.
|
||||
*
|
||||
* The whole destination tree is fetched once and indexed by path relative to
|
||||
* the destination, then every entry is looked up directly — no need to mirror
|
||||
* the upload's folder structure.
|
||||
*
|
||||
* Directory handling differs by action, hence `includeDirectories`:
|
||||
* - Upload (false): an existing folder is silently merged, so only the
|
||||
* individual files inside it can conflict.
|
||||
* - Copy/move (true): the server stats the destination and rejects it whole if
|
||||
* a same-named entry exists, so the directory itself is a conflict. The list
|
||||
* only holds the top-level items being moved, so each is reported once.
|
||||
* - Upload (false): the destination tree is fetched recursively so nested
|
||||
* file uploads can be checked; existing folders are silently merged.
|
||||
* - Copy/move (true): only the destination directory itself is fetched. These
|
||||
* operations move flat top-level selections, so a same-named direct child is
|
||||
* the only preflight conflict the backend will reject.
|
||||
*
|
||||
* @param files - flat upload list to check
|
||||
* @param basePath - server destination path (e.g. "/files/uploads/")
|
||||
@@ -47,26 +101,19 @@ export async function checkConflict(
|
||||
): Promise<ConflictingResource[]> {
|
||||
if (files.length === 0) return [];
|
||||
|
||||
let serverEntries: RecursiveEntry[];
|
||||
let serverEntries: ServerConflictEntry[];
|
||||
try {
|
||||
// Single API call: fetch the entire server tree under basePath.
|
||||
serverEntries = await api.fetchAll(basePath);
|
||||
serverEntries = await fetchConflictEntries(basePath, includeDirectories);
|
||||
} catch {
|
||||
// The destination doesn't exist yet, so nothing can conflict.
|
||||
return [];
|
||||
}
|
||||
|
||||
// The server returns paths absolute within the user's scope
|
||||
// (e.g. "/uploads/sub/file.txt"). Strip the basePath prefix so the keys line
|
||||
// up with each entry's conflictKey, which is relative to the destination.
|
||||
const normBase = removePrefix(basePath).replace(/\/+$/, "");
|
||||
const serverMap = new Map<string, RecursiveEntry>();
|
||||
for (const entry of serverEntries) {
|
||||
const rel = entry.path.startsWith(normBase)
|
||||
? entry.path.slice(normBase.length)
|
||||
: entry.path;
|
||||
serverMap.set(rel.replace(/^\/+/, ""), entry);
|
||||
}
|
||||
const serverMap = buildConflictMap(
|
||||
serverEntries,
|
||||
basePath,
|
||||
includeDirectories
|
||||
);
|
||||
|
||||
const conflicts: ConflictingResource[] = [];
|
||||
files.forEach((file, index) => {
|
||||
@@ -77,7 +124,7 @@ export async function checkConflict(
|
||||
|
||||
conflicts.push({
|
||||
index,
|
||||
name: server.path,
|
||||
name: conflictPath(server),
|
||||
origin: { lastModified: file.file?.lastModified, size: file.size },
|
||||
dest: { lastModified: server.modified, size: server.size },
|
||||
checked: ["origin"],
|
||||
|
||||
@@ -162,7 +162,11 @@
|
||||
"
|
||||
style="height: 12em; padding: 0; margin: 0"
|
||||
>
|
||||
<img style="height: 12em" :src="raw" />
|
||||
<img
|
||||
style="height: 12em"
|
||||
:src="raw"
|
||||
:alt="req.items[fileStore.selected[0]].name"
|
||||
/>
|
||||
</a>
|
||||
<div
|
||||
v-else-if="
|
||||
|
||||
@@ -846,7 +846,7 @@ const drop = async (event: DragEvent) => {
|
||||
}
|
||||
}
|
||||
if (files.length > 0) {
|
||||
upload.handleFiles(files, path, true);
|
||||
upload.handleFiles(files, path);
|
||||
fileStore.preselect = preselect;
|
||||
}
|
||||
},
|
||||
@@ -902,7 +902,7 @@ const uploadInput = async (event: Event) => {
|
||||
}
|
||||
}
|
||||
if (uploadFiles.length > 0) {
|
||||
upload.handleFiles(uploadFiles, path, true);
|
||||
upload.handleFiles(uploadFiles, path);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import FileListing from "@/views/files/FileListing.vue";
|
||||
import UploadPrompt from "@/components/prompts/Upload.vue";
|
||||
|
||||
const harness = vi.hoisted(() => ({
|
||||
checkConflict: vi.fn(),
|
||||
scanFiles: vi.fn(),
|
||||
handleFiles: vi.fn(),
|
||||
queueUpload: vi.fn(),
|
||||
showHover: vi.fn(),
|
||||
closeHovers: vi.fn(),
|
||||
fileStore: {
|
||||
req: { items: [] },
|
||||
selected: [] as number[],
|
||||
selectedCount: 0,
|
||||
multiple: false,
|
||||
preselect: "",
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/stores/auth", () => ({
|
||||
useAuthStore: () => ({ user: null }),
|
||||
}));
|
||||
vi.mock("@/stores/clipboard", () => ({
|
||||
useClipboardStore: () => ({ items: [], $patch: vi.fn() }),
|
||||
}));
|
||||
vi.mock("@/stores/file", () => ({
|
||||
useFileStore: () => harness.fileStore,
|
||||
}));
|
||||
vi.mock("@/stores/layout", () => ({
|
||||
useLayoutStore: () => ({
|
||||
currentPrompt: null,
|
||||
showHover: harness.showHover,
|
||||
closeHovers: harness.closeHovers,
|
||||
}),
|
||||
}));
|
||||
vi.mock("@/stores/upload", () => ({
|
||||
useUploadStore: () => ({ upload: harness.queueUpload }),
|
||||
}));
|
||||
vi.mock("@/api", () => ({
|
||||
users: {},
|
||||
files: {},
|
||||
}));
|
||||
vi.mock("@/utils/constants", () => ({ enableExec: false }));
|
||||
vi.mock("@/utils/auth", () => ({}));
|
||||
vi.mock("@/router", () => ({ default: {} }));
|
||||
vi.mock("@/i18n", () => ({ default: {} }));
|
||||
vi.mock("@/utils/upload", () => ({
|
||||
checkConflict: harness.checkConflict,
|
||||
scanFiles: harness.scanFiles,
|
||||
handleFiles: harness.handleFiles,
|
||||
}));
|
||||
vi.mock("@/utils/css", () => ({ default: vi.fn() }));
|
||||
vi.mock("@/components/header/HeaderBar.vue", () => ({ default: {} }));
|
||||
vi.mock("@/components/header/Action.vue", () => ({ default: {} }));
|
||||
vi.mock("@/components/Search.vue", () => ({ default: {} }));
|
||||
vi.mock("@/components/files/ListingItem.vue", () => ({ default: {} }));
|
||||
vi.mock("@/components/ContextMenu.vue", () => ({ default: {} }));
|
||||
vi.mock("vue-router", () => ({
|
||||
useRoute: () => ({ path: "/files/target/" }),
|
||||
onBeforeRouteUpdate: vi.fn(),
|
||||
}));
|
||||
vi.mock("vue-i18n", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("vue-i18n")>()),
|
||||
useI18n: () => ({ t: (key: string) => key }),
|
||||
}));
|
||||
vi.mock("pinia", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("pinia")>()),
|
||||
storeToRefs: () => ({ req: { value: harness.fileStore.req } }),
|
||||
}));
|
||||
vi.mock("vue", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("vue")>()),
|
||||
inject: () => vi.fn(),
|
||||
watch: vi.fn(),
|
||||
onMounted: vi.fn(),
|
||||
onBeforeUnmount: vi.fn(),
|
||||
useSSRContext: () => ({ modules: new Set<string>() }),
|
||||
}));
|
||||
|
||||
const file = (name: string): UploadEntry => ({
|
||||
file: { name, size: 12, type: "text/plain" } as File,
|
||||
name,
|
||||
size: 12,
|
||||
isDir: false,
|
||||
});
|
||||
|
||||
const conflict = (
|
||||
index: number,
|
||||
checked: Array<"origin" | "dest">
|
||||
): ConflictingResource => ({
|
||||
index,
|
||||
name: `/target/file-${index}.txt`,
|
||||
origin: { size: 12 },
|
||||
dest: { size: 10 },
|
||||
checked,
|
||||
isSmallerOnServer: true,
|
||||
});
|
||||
|
||||
function setup(component: any) {
|
||||
return component.setup({}, { expose: vi.fn() });
|
||||
}
|
||||
|
||||
function confirmPrompt(result: ConflictingResource[]) {
|
||||
const prompt = harness.showHover.mock.calls[0][0];
|
||||
prompt.confirm({ preventDefault: vi.fn() }, result);
|
||||
}
|
||||
|
||||
async function runActualHandleFiles() {
|
||||
const [files, path, overwrite] = harness.handleFiles.mock.calls[0];
|
||||
const actual =
|
||||
await vi.importActual<typeof import("@/utils/upload")>("@/utils/upload");
|
||||
actual.handleFiles(files, path, overwrite);
|
||||
}
|
||||
|
||||
function uploadFlags() {
|
||||
return harness.queueUpload.mock.calls.map((call) => call[3]);
|
||||
}
|
||||
|
||||
describe("upload conflict resolution", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
harness.fileStore.preselect = "";
|
||||
vi.stubGlobal("window", {
|
||||
innerWidth: 1024,
|
||||
innerHeight: 768,
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
});
|
||||
vi.stubGlobal("document", {
|
||||
getElementsByClassName: () => [],
|
||||
});
|
||||
});
|
||||
|
||||
it("authorizes an explicit drag/drop Replace choice", async () => {
|
||||
const upload = file("file-0.txt");
|
||||
harness.scanFiles.mockResolvedValue([upload]);
|
||||
harness.checkConflict.mockResolvedValue([conflict(0, ["origin"])]);
|
||||
const bindings = setup(FileListing);
|
||||
|
||||
await bindings.drop({
|
||||
preventDefault: vi.fn(),
|
||||
dataTransfer: { files: [upload.file], items: [] },
|
||||
target: {
|
||||
classList: { contains: () => false },
|
||||
parentElement: null,
|
||||
},
|
||||
});
|
||||
confirmPrompt([conflict(0, ["origin"])]);
|
||||
await runActualHandleFiles();
|
||||
|
||||
expect(uploadFlags()).toEqual([true]);
|
||||
});
|
||||
|
||||
it("keeps the forbidden both-selected upload overwrite-safe", async () => {
|
||||
const upload = file("file-0.txt");
|
||||
harness.scanFiles.mockResolvedValue([upload]);
|
||||
harness.checkConflict.mockResolvedValue([conflict(0, ["origin"])]);
|
||||
const bindings = setup(FileListing);
|
||||
|
||||
await bindings.drop({
|
||||
preventDefault: vi.fn(),
|
||||
dataTransfer: { files: [upload.file], items: [] },
|
||||
target: {
|
||||
classList: { contains: () => false },
|
||||
parentElement: null,
|
||||
},
|
||||
});
|
||||
confirmPrompt([conflict(0, ["origin", "dest"])]);
|
||||
await runActualHandleFiles();
|
||||
|
||||
expect(uploadFlags()).toEqual([false]);
|
||||
});
|
||||
|
||||
it("applies Replace only to the selected file in a mixed batch", async () => {
|
||||
const conflicting = file("file-0.txt");
|
||||
const nonconflicting = file("new-file.txt");
|
||||
harness.checkConflict.mockResolvedValue([conflict(0, ["origin"])]);
|
||||
const bindings = setup(FileListing);
|
||||
|
||||
await bindings.uploadInput({
|
||||
currentTarget: { files: [conflicting.file, nonconflicting.file] },
|
||||
});
|
||||
confirmPrompt([conflict(0, ["origin"])]);
|
||||
await runActualHandleFiles();
|
||||
|
||||
expect(uploadFlags()).toEqual([true, false]);
|
||||
});
|
||||
|
||||
it("keeps a nonconflicting sibling protected after Skip", async () => {
|
||||
const conflicting = file("file-0.txt");
|
||||
const nonconflicting = file("late-file.txt");
|
||||
harness.checkConflict.mockResolvedValue([conflict(0, ["origin"])]);
|
||||
const bindings = setup(FileListing);
|
||||
|
||||
await bindings.uploadInput({
|
||||
currentTarget: { files: [conflicting.file, nonconflicting.file] },
|
||||
});
|
||||
confirmPrompt([conflict(0, ["dest"])]);
|
||||
await runActualHandleFiles();
|
||||
|
||||
expect(harness.queueUpload).toHaveBeenCalledTimes(1);
|
||||
expect(harness.queueUpload).toHaveBeenCalledWith(
|
||||
"/files/target/late-file.txt",
|
||||
"late-file.txt",
|
||||
nonconflicting.file,
|
||||
false,
|
||||
"text"
|
||||
);
|
||||
});
|
||||
|
||||
it("matches the Upload prompt per-file overwrite semantics", async () => {
|
||||
const conflicting = file("file-0.txt");
|
||||
const nonconflicting = file("new-file.txt");
|
||||
harness.checkConflict.mockResolvedValue([conflict(0, ["origin"])]);
|
||||
const bindings = setup(UploadPrompt);
|
||||
|
||||
await bindings.uploadInput({
|
||||
currentTarget: { files: [conflicting.file, nonconflicting.file] },
|
||||
});
|
||||
confirmPrompt([conflict(0, ["origin"])]);
|
||||
await runActualHandleFiles();
|
||||
|
||||
expect(uploadFlags()).toEqual([true, false]);
|
||||
});
|
||||
});
|
||||
@@ -4,30 +4,30 @@ go 1.25.0
|
||||
|
||||
require (
|
||||
github.com/asdine/storm/v3 v3.2.1
|
||||
github.com/asticode/go-astisub v0.40.0
|
||||
github.com/asticode/go-astisub v0.41.0
|
||||
github.com/disintegration/imaging v1.6.2
|
||||
github.com/dsoprea/go-exif/v3 v3.0.1
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/jellydator/ttlcache/v3 v3.4.0
|
||||
github.com/jellydator/ttlcache/v3 v3.4.1
|
||||
github.com/maruel/natural v1.3.0
|
||||
github.com/marusama/semaphore/v2 v2.5.0
|
||||
github.com/mholt/archives v0.1.5
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/redis/go-redis/v9 v9.20.1
|
||||
github.com/redis/go-redis/v9 v9.21.0
|
||||
github.com/samber/lo v1.53.0
|
||||
github.com/shirou/gopsutil/v4 v4.26.5
|
||||
github.com/shirou/gopsutil/v4 v4.26.6
|
||||
github.com/spf13/afero v1.15.0
|
||||
github.com/spf13/cobra v1.10.2
|
||||
github.com/spf13/pflag v1.0.10
|
||||
github.com/spf13/viper v1.21.0
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce
|
||||
go.etcd.io/bbolt v1.4.3
|
||||
go.etcd.io/bbolt v1.5.0
|
||||
golang.org/x/crypto v0.53.0
|
||||
golang.org/x/image v0.42.0
|
||||
golang.org/x/image v0.43.0
|
||||
golang.org/x/text v0.38.0
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
@@ -35,7 +35,7 @@ require (
|
||||
|
||||
require (
|
||||
github.com/STARRY-S/zip v0.2.3 // indirect
|
||||
github.com/andybalholm/brotli v1.2.1 // indirect
|
||||
github.com/andybalholm/brotli v1.2.2 // indirect
|
||||
github.com/asticode/go-astikit v0.59.0 // indirect
|
||||
github.com/asticode/go-astits v1.15.0 // indirect
|
||||
github.com/bodgit/plumbing v1.3.0 // indirect
|
||||
@@ -52,16 +52,16 @@ require (
|
||||
github.com/go-errors/errors v1.5.1 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
|
||||
github.com/golang/geo v0.0.0-20260612074446-f1a45663b0f3 // indirect
|
||||
github.com/golang/geo v0.0.0-20260625163123-7c0e84413537 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/klauspost/compress v1.18.6 // indirect
|
||||
github.com/klauspost/compress v1.19.0 // indirect
|
||||
github.com/klauspost/pgzip v1.2.6 // indirect
|
||||
github.com/mikelolasagasti/xz v1.0.1 // indirect
|
||||
github.com/minio/minlz v1.1.1 // indirect
|
||||
github.com/nwaples/rardecode/v2 v2.2.3 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.3.1 // indirect
|
||||
github.com/nwaples/rardecode/v2 v2.2.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.4.2 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.27 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||
|
||||
@@ -4,16 +4,16 @@ github.com/STARRY-S/zip v0.2.3 h1:luE4dMvRPDOWQdeDdUxUoZkzUIpTccdKdhHHsQJ1fm4=
|
||||
github.com/STARRY-S/zip v0.2.3/go.mod h1:lqJ9JdeRipyOQJrYSOtpNAiaesFO6zVDsE8GIGFaoSk=
|
||||
github.com/Sereal/Sereal v0.0.0-20190618215532-0b8ac451a863 h1:BRrxwOZBolJN4gIwvZMJY1tzqBvQgpaZiQRuIDD40jM=
|
||||
github.com/Sereal/Sereal v0.0.0-20190618215532-0b8ac451a863/go.mod h1:D0JMgToj/WdxCgd30Kc1UcA9E+WdZoJqeVOuYW7iTBM=
|
||||
github.com/andybalholm/brotli v1.2.1 h1:R+f5xP285VArJDRgowrfb9DqL18yVK0gKAW/F+eTWro=
|
||||
github.com/andybalholm/brotli v1.2.1/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||
github.com/andybalholm/brotli v1.2.2 h1:HzTuoo2ErYQqf5qvcJInB8uvqSVxRttzkFexPWtnceM=
|
||||
github.com/andybalholm/brotli v1.2.2/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||
github.com/asdine/storm/v3 v3.2.1 h1:I5AqhkPK6nBZ/qJXySdI7ot5BlXSZ7qvDY1zAn5ZJac=
|
||||
github.com/asdine/storm/v3 v3.2.1/go.mod h1:LEpXwGt4pIqrE/XcTvCnZHT5MgZCV6Ub9q7yQzOFWr0=
|
||||
github.com/asticode/go-astikit v0.20.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0=
|
||||
github.com/asticode/go-astikit v0.30.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0=
|
||||
github.com/asticode/go-astikit v0.59.0 h1:tjbwDym+MTSxqkAhJoHRZmHMXK6Jv4vGx+97FptKH6k=
|
||||
github.com/asticode/go-astikit v0.59.0/go.mod h1:fV43j20UZYfXzP9oBn33udkvCvDvCDhzjVqoLFuuYZE=
|
||||
github.com/asticode/go-astisub v0.40.0 h1:Z8tAXHngjkh/4L9zqt49ru9UdpDTqBIe+80xexKM3/I=
|
||||
github.com/asticode/go-astisub v0.40.0/go.mod h1:WTkuSzFB+Bp7wezuSf2Oxulj5A8zu2zLRVFf6bIFQK8=
|
||||
github.com/asticode/go-astisub v0.41.0 h1:XFPIreVnpi9nPNVRmTdRuq4fr9XzGhgCRwpAaccnShM=
|
||||
github.com/asticode/go-astisub v0.41.0/go.mod h1:WTkuSzFB+Bp7wezuSf2Oxulj5A8zu2zLRVFf6bIFQK8=
|
||||
github.com/asticode/go-astits v1.8.0/go.mod h1:DkOWmBNQpnr9mv24KfZjq4JawCFX1FCqjLVGvO0DygQ=
|
||||
github.com/asticode/go-astits v1.15.0 h1:yRyCiUc8Jj4F7clt2GDxHghMpWuFL5rkaLuGUd2/0J4=
|
||||
github.com/asticode/go-astits v1.15.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI=
|
||||
@@ -82,8 +82,8 @@ github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArs
|
||||
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
||||
github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
||||
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
||||
github.com/golang/geo v0.0.0-20260612074446-f1a45663b0f3 h1:UlucSQUu9SZdDRlMWv5N/T3Rig9gv615vWvHFKrXHWA=
|
||||
github.com/golang/geo v0.0.0-20260612074446-f1a45663b0f3/go.mod h1:Mymr9kRGDc64JPr03TSZmuIBODZ3KyswLzm1xL0HFA8=
|
||||
github.com/golang/geo v0.0.0-20260625163123-7c0e84413537 h1:KeIaDS/+VEy/bhDYjG3Z78dOyLAU4HXcVxmd0WYHJTE=
|
||||
github.com/golang/geo v0.0.0-20260625163123-7c0e84413537/go.mod h1:Mymr9kRGDc64JPr03TSZmuIBODZ3KyswLzm1xL0HFA8=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
@@ -101,13 +101,13 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/jellydator/ttlcache/v3 v3.4.0 h1:YS4P125qQS0tNhtL6aeYkheEaB/m8HCqdMMP4mnWdTY=
|
||||
github.com/jellydator/ttlcache/v3 v3.4.0/go.mod h1:Hw9EgjymziQD3yGsQdf1FqFdpp7YjFMd4Srg5EJlgD4=
|
||||
github.com/jellydator/ttlcache/v3 v3.4.1 h1:bOdXmXiycyK6E6Qjyuj5vl+/vU3SCOoDs8a86NbHjAQ=
|
||||
github.com/jellydator/ttlcache/v3 v3.4.1/go.mod h1:j7LO12PNghFg5+0v9budMAT4rDK4JY969jb9vOdOBBk=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
||||
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao=
|
||||
github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/compress v1.19.0 h1:sXLILfc9jV2QYWkzFOPWStmcUVH2RHEB1JCdY2oVvCQ=
|
||||
github.com/klauspost/compress v1.19.0/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=
|
||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||
@@ -134,10 +134,10 @@ github.com/minio/minlz v1.1.1 h1:OGmft1V6AnI/Wme332U6bhG54nxEan+VFgkD7lat4KM=
|
||||
github.com/minio/minlz v1.1.1/go.mod h1:qT0aEB35q79LLornSzeDH75LBf3aH1MV+jB5w9Wasec=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/nwaples/rardecode/v2 v2.2.3 h1:qaVuy3ChZDbAQZshPLjHeNJKF3Cru8uo9jmgveKIy2A=
|
||||
github.com/nwaples/rardecode/v2 v2.2.3/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
|
||||
github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc=
|
||||
github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||
github.com/nwaples/rardecode/v2 v2.2.5 h1:L5doqgGfQwI7qADJMqnkrSB86rpPsqQDrHeO0HWa5JY=
|
||||
github.com/nwaples/rardecode/v2 v2.2.5/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
|
||||
github.com/pelletier/go-toml/v2 v2.4.2 h1:M2fKKbmyvI+hGId/D0W64qDBMVhJnNR10O5gIbMc//Q=
|
||||
github.com/pelletier/go-toml/v2 v2.4.2/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||
github.com/pierrec/lz4/v4 v4.1.27 h1:+PhzhWDrjRj89TH2sw43nE3+4+W8lSxIuQadEHZyjUk=
|
||||
github.com/pierrec/lz4/v4 v4.1.27/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4=
|
||||
github.com/pkg/profile v1.4.0/go.mod h1:NWz/XGvpEW1FyYQ7fCx4dqYBLlfTcE+A9FLAkNKqjFE=
|
||||
@@ -146,8 +146,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/redis/go-redis/v9 v9.20.1 h1:sfCU6A8P3dXbKyWes02uxA2baehGux9dZHfEKtsTB1w=
|
||||
github.com/redis/go-redis/v9 v9.20.1/go.mod h1:v/M13XI1PVCDcm01VtPFOADfZtHf8YW3baQf57KlIkA=
|
||||
github.com/redis/go-redis/v9 v9.21.0 h1:FPBE4hhbAke+TLmcY3WkpbDffJEomdqPn3HYiqAtL9E=
|
||||
github.com/redis/go-redis/v9 v9.21.0/go.mod h1:v/M13XI1PVCDcm01VtPFOADfZtHf8YW3baQf57KlIkA=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
@@ -156,8 +156,8 @@ github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88ee
|
||||
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
|
||||
github.com/samber/lo v1.53.0 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM=
|
||||
github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
|
||||
github.com/shirou/gopsutil/v4 v4.26.5 h1:RPcBXkpz7kOj9PqGFQOlBPZHsyaPvPVQc098y9RmCNM=
|
||||
github.com/shirou/gopsutil/v4 v4.26.5/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ=
|
||||
github.com/shirou/gopsutil/v4 v4.26.6 h1:Mzr/npDtQC/xpeEuQKHZt8Zo9CmPvhTj8nkR8w5TLDs=
|
||||
github.com/shirou/gopsutil/v4 v4.26.6/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ=
|
||||
github.com/sorairolake/lzip-go v0.3.8 h1:j5Q2313INdTA80ureWYRhX+1K78mUXfMoPZCw/ivWik=
|
||||
github.com/sorairolake/lzip-go v0.3.8/go.mod h1:JcBqGMV0frlxwrsE9sMWXDjqn3EeVf0/54YPsw66qkU=
|
||||
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
|
||||
@@ -201,8 +201,8 @@ github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ
|
||||
github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
|
||||
github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
|
||||
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||
go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo=
|
||||
go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E=
|
||||
go.etcd.io/bbolt v1.5.0 h1:S7GAl7Fxv12yohbwFfIbQCGDWbQbtDGPET4P/bD4lxU=
|
||||
go.etcd.io/bbolt v1.5.0/go.mod h1:mkltfYE5aUHQxUct9N9V+Kp7aSjFqjgrhcXIS70Lrdk=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
@@ -216,8 +216,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
|
||||
golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto=
|
||||
golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.42.0 h1:1gSs6ehNWXLbkHBIPcWztk3D/6aIA/8hauiAYtlodVY=
|
||||
golang.org/x/image v0.42.0/go.mod h1:rrpelvGFt+kLPAjPM4HeWPgrl0FtafueU//e5N0qk/Q=
|
||||
golang.org/x/image v0.43.0 h1:FLxcP4ec2350nTfOC8ysKtqYSIFbk/QGjw1ZHNP4tsY=
|
||||
golang.org/x/image v0.43.0/go.mod h1:rrpelvGFt+kLPAjPM4HeWPgrl0FtafueU//e5N0qk/Q=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
|
||||
+4
-8
@@ -191,19 +191,15 @@ var signupHandler = func(w http.ResponseWriter, r *http.Request, d *data) (int,
|
||||
}
|
||||
|
||||
user.Password = pwd
|
||||
if d.settings.CreateUserDir {
|
||||
user.Scope = ""
|
||||
}
|
||||
|
||||
userHome, err := d.settings.MakeUserDir(user.Username, user.Scope, d.server.Root)
|
||||
derivedScope, err := d.settings.CreateUserHome(user, d.server.Root, false)
|
||||
if err != nil {
|
||||
log.Printf("create user: failed to mkdir user home dir: [%s]", userHome)
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
user.Scope = userHome
|
||||
log.Printf("new user: %s, home dir: [%s].", user.Username, userHome)
|
||||
|
||||
err = d.store.Users.Save(user)
|
||||
log.Printf("new user: %s, home dir: [%s].", user.Username, user.Scope)
|
||||
|
||||
err = d.store.Users.SaveProvisioned(user, derivedScope)
|
||||
if errors.Is(err, fberrors.ErrExist) {
|
||||
return http.StatusConflict, err
|
||||
} else if err != nil {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package fbhttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/asdine/storm/v3"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/settings"
|
||||
"github.com/filebrowser/filebrowser/v2/storage/bolt"
|
||||
)
|
||||
|
||||
// Regression for the username-normalization home-directory collision
|
||||
// (GHSA-7rc3-g7h6-22m7): with Signup and CreateUserDir enabled, two distinct
|
||||
// usernames that cleanUsername() normalizes to the same directory must not be
|
||||
// handed the same home directory. The second registration is rejected.
|
||||
func TestSignupRejectsCollidingNormalizedScope(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
|
||||
db, err := storm.Open(filepath.Join(t.TempDir(), "db"))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to open db: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { _ = db.Close() })
|
||||
|
||||
st, err := bolt.NewStorage(db)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get storage: %v", err)
|
||||
}
|
||||
if err := st.Settings.Save(&settings.Settings{
|
||||
Key: []byte("test-signing-key"),
|
||||
Signup: true,
|
||||
CreateUserDir: true,
|
||||
UserHomeBasePath: "/users",
|
||||
MinimumPasswordLength: 1,
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to save settings: %v", err)
|
||||
}
|
||||
|
||||
server := &settings.Server{Root: root}
|
||||
|
||||
signup := func(username string) *httptest.ResponseRecorder {
|
||||
body := `{"username":"` + username + `","password":"CollidePw12345!"}`
|
||||
req, _ := http.NewRequest(http.MethodPost, "/signup", strings.NewReader(body))
|
||||
rec := httptest.NewRecorder()
|
||||
handle(signupHandler, "", st, server).ServeHTTP(rec, req)
|
||||
return rec
|
||||
}
|
||||
|
||||
// Victim registers first and gets /users/teamone-x.
|
||||
if rec := signup("teamone-x"); rec.Code != http.StatusOK {
|
||||
t.Fatalf("first signup: expected 200, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
// Attacker picks a distinct username that normalizes to the same scope.
|
||||
if rec := signup("teamone/x"); rec.Code != http.StatusConflict {
|
||||
t.Fatalf("VULNERABLE: colliding signup expected 409, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
// The shared scope must still be owned solely by the first user.
|
||||
owner, err := st.Users.GetByScope("/users/teamone-x")
|
||||
if err != nil {
|
||||
t.Fatalf("expected first user to own the scope: %v", err)
|
||||
}
|
||||
if owner.Username != "teamone-x" {
|
||||
t.Fatalf("scope owner = %q, want teamone-x", owner.Username)
|
||||
}
|
||||
}
|
||||
+14
-6
@@ -2,6 +2,7 @@ package fbhttp
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -125,12 +126,19 @@ func getFiles(d *data, path, commonPath string) ([]archives.FileInfo, error) {
|
||||
nameInArchive := strings.TrimPrefix(path, commonPath)
|
||||
nameInArchive = strings.TrimPrefix(nameInArchive, string(filepath.Separator))
|
||||
nameInArchive = filepath.ToSlash(nameInArchive)
|
||||
// filepath.ToSlash only rewrites the host separator, so on a Linux
|
||||
// host a stored backslash survives and is emitted verbatim into the
|
||||
// archive. Windows extractors then treat "\" as a path separator,
|
||||
// allowing the entry to escape the extraction directory (zip-slip).
|
||||
// Strip Windows separators regardless of host OS.
|
||||
nameInArchive = strings.ReplaceAll(nameInArchive, "\\", "/")
|
||||
// A backslash is a legal filename character on POSIX hosts, so it can
|
||||
// reach here verbatim. Rewriting it to the path separator "/" would
|
||||
// manufacture a traversal sequence (e.g. "..\..\x" -> "../../x") that
|
||||
// escapes the extraction directory on the victim's machine, while
|
||||
// leaving it as "\" lets Windows extractors treat it as a separator.
|
||||
// Neutralize it to an inert character instead of turning it into one.
|
||||
nameInArchive = strings.ReplaceAll(nameInArchive, "\\", "_")
|
||||
|
||||
// Defense in depth: never emit an archive entry whose path escapes the
|
||||
// archive root, regardless of how the name was produced.
|
||||
if cleaned := gopath.Clean("/" + nameInArchive); cleaned != "/"+nameInArchive {
|
||||
return nil, fmt.Errorf("refusing unsafe archive entry name: %q", nameInArchive)
|
||||
}
|
||||
|
||||
archiveFiles = append(archiveFiles, archives.FileInfo{
|
||||
FileInfo: info,
|
||||
|
||||
@@ -1,14 +1,75 @@
|
||||
package fbhttp
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/files"
|
||||
"github.com/filebrowser/filebrowser/v2/settings"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
)
|
||||
|
||||
// Regression for the archive backslash-to-slash zip-slip (GHSA-83xp-526h-j3ww):
|
||||
// a single in-scope file whose name contains backslashes is a legal POSIX
|
||||
// filename, not a traversal. The archive builder must never rewrite "\" into the
|
||||
// path separator "/", which would manufacture an entry like "../../evil.sh" that
|
||||
// escapes the extraction directory on the downloader's machine.
|
||||
func TestRawArchiveDoesNotManufactureTraversal(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
userScope := filepath.Join(root, "user")
|
||||
if err := os.MkdirAll(filepath.Join(userScope, "ziptest"), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// One legal Linux/macOS filename whose bytes include backslashes. It does not
|
||||
// traverse on the server; it only becomes "../../evil.sh" if the builder
|
||||
// turns "\" into "/".
|
||||
planted := filepath.Join(userScope, "ziptest", "..\\..\\evil.sh")
|
||||
if err := os.WriteFile(planted, []byte("#!/bin/sh\necho PWNED"), 0o644); err != nil {
|
||||
t.Skipf("cannot create backslash-named file: %v", err)
|
||||
}
|
||||
|
||||
key := []byte("test-signing-key")
|
||||
perm := users.Permissions{Download: true}
|
||||
st := scopedUserStorage(t, userScope, perm, key)
|
||||
signed := signToken(t, perm, key)
|
||||
|
||||
req, _ := http.NewRequest(http.MethodGet, "/ziptest?algo=zip", http.NoBody)
|
||||
req.Header.Set("X-Auth", signed)
|
||||
rec := httptest.NewRecorder()
|
||||
handle(rawHandler, "", st, &settings.Server{}).ServeHTTP(rec, req)
|
||||
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected 200, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
zr, err := zip.NewReader(bytes.NewReader(rec.Body.Bytes()), int64(rec.Body.Len()))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read zip: %v", err)
|
||||
}
|
||||
if len(zr.File) == 0 {
|
||||
t.Fatal("archive has no entries")
|
||||
}
|
||||
|
||||
for _, f := range zr.File {
|
||||
// The entry must be a normalized, root-relative path: no ".." segments
|
||||
// and no leading "/". Note a name may legitimately contain ".." as part of
|
||||
// a single filename (e.g. ".._.._evil.sh"), which Clean leaves untouched —
|
||||
// so compare against the normalized form rather than searching for "..".
|
||||
if strings.HasPrefix(f.Name, "/") || path.Clean("/"+f.Name) != "/"+f.Name {
|
||||
t.Errorf("VULNERABLE: archive entry escapes root: %q", f.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetContentDisposition(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
+11
-2
@@ -67,6 +67,10 @@ var resourceGetHandler = withUser(func(w http.ResponseWriter, r *http.Request, d
|
||||
}
|
||||
|
||||
if checksum := r.URL.Query().Get("checksum"); checksum != "" {
|
||||
if !d.user.Perm.Download {
|
||||
return http.StatusAccepted, nil
|
||||
}
|
||||
|
||||
err := file.Checksum(checksum)
|
||||
if errors.Is(err, fberrors.ErrInvalidOption) {
|
||||
return http.StatusBadRequest, nil
|
||||
@@ -130,7 +134,9 @@ func resourcePostHandler(fileCache FileCache) handleFunc {
|
||||
|
||||
// Directories creation on POST.
|
||||
if strings.HasSuffix(r.URL.Path, "/") {
|
||||
err := d.user.Fs.MkdirAll(r.URL.Path, d.settings.DirMode)
|
||||
err := d.RunHook(func() error {
|
||||
return d.user.Fs.MkdirAll(r.URL.Path, d.settings.DirMode)
|
||||
}, "upload", r.URL.Path, "", d.user)
|
||||
return errToStatus(err), err
|
||||
}
|
||||
|
||||
@@ -424,7 +430,10 @@ var resourceGetRecursiveHandler = withUser(func(w http.ResponseWriter, r *http.R
|
||||
}
|
||||
|
||||
entries = append(entries, RecursiveEntry{
|
||||
Path: fPath,
|
||||
// afero.Walk joins paths with the OS separator, so on Windows fPath
|
||||
// uses backslashes. The web API contract is forward slashes, so
|
||||
// normalize it here (mirrors search/search.go).
|
||||
Path: filepath.ToSlash(fPath),
|
||||
Name: info.Name(),
|
||||
Size: info.Size(),
|
||||
ModTime: info.ModTime(),
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package fbhttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/settings"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
)
|
||||
|
||||
// The ?checksum= branch reads the whole file to compute a digest, so it must be
|
||||
// gated behind Perm.Download like the other read paths. A user without download
|
||||
// permission must not obtain a digest of a file they cannot download.
|
||||
func TestResourceChecksumRequiresDownloadPermission(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
userScope := filepath.Join(root, "user")
|
||||
if err := os.MkdirAll(userScope, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(userScope, "secret.txt"), []byte("classified"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
key := []byte("test-signing-key")
|
||||
|
||||
get := func(t *testing.T, perm users.Permissions) *httptest.ResponseRecorder {
|
||||
st := scopedUserStorage(t, userScope, perm, key)
|
||||
req, _ := http.NewRequest(http.MethodGet, "/secret.txt?checksum=sha256", http.NoBody)
|
||||
req.Header.Set("X-Auth", signToken(t, perm, key))
|
||||
rec := httptest.NewRecorder()
|
||||
handle(resourceGetHandler, "", st, &settings.Server{}).ServeHTTP(rec, req)
|
||||
return rec
|
||||
}
|
||||
|
||||
t.Run("denied without download permission", func(t *testing.T) {
|
||||
rec := get(t, users.Permissions{})
|
||||
if rec.Code != http.StatusAccepted {
|
||||
t.Fatalf("expected 202, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
if strings.Contains(strings.ToLower(rec.Body.String()), "checksum") {
|
||||
t.Fatalf("digest leaked without download permission: %q", rec.Body.String())
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("allowed with download permission", func(t *testing.T) {
|
||||
rec := get(t, users.Permissions{Download: true})
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected 200, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
if !strings.Contains(rec.Body.String(), "checksums") {
|
||||
t.Fatalf("expected a checksum in the response, got %q", rec.Body.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -222,3 +222,38 @@ func TestResourcePostCleanupDoesNotDeleteThroughSymlink(t *testing.T) {
|
||||
t.Fatalf("VULNERABLE: out-of-scope victim.txt deleted by cleanup RemoveAll (status=%d): %v", rec.Code, statErr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResourcePostRunsUploadHooksForDirectories(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
userScope := filepath.Join(root, "user")
|
||||
if err := os.MkdirAll(userScope, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
key := []byte("test-signing-key")
|
||||
perm := users.Permissions{Create: true}
|
||||
st := scopedUserStorage(t, userScope, perm, key)
|
||||
if err := st.Settings.Save(&settings.Settings{
|
||||
Key: key,
|
||||
Commands: map[string][]string{
|
||||
"after_upload": {"filebrowser-hook-command-that-does-not-exist"},
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
req, _ := http.NewRequest(http.MethodPost, "/created/", http.NoBody)
|
||||
req.Header.Set("X-Auth", signToken(t, perm, key))
|
||||
rec := httptest.NewRecorder()
|
||||
handle(resourcePostHandler(diskcache.NewNoOp()), "", st, &settings.Server{EnableExec: true}).ServeHTTP(rec, req)
|
||||
|
||||
// A missing after_upload command makes the request fail only if the hook ran.
|
||||
// It avoids a platform-specific helper executable while still exercising the
|
||||
// same path the web UI uses for directory uploads.
|
||||
if rec.Code != http.StatusInternalServerError {
|
||||
t.Fatalf("expected directory upload hook failure to return 500, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(userScope, "created")); err != nil {
|
||||
t.Fatalf("expected directory to be created before its after hook, got %v", err)
|
||||
}
|
||||
}
|
||||
+64
-6
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -14,9 +15,40 @@ import (
|
||||
|
||||
fberrors "github.com/filebrowser/filebrowser/v2/errors"
|
||||
"github.com/filebrowser/filebrowser/v2/share"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
// shareResponse is the client-facing representation of a share. It deliberately
|
||||
// omits the server-side secrets of share.Link — the bcrypt PasswordHash (which
|
||||
// would be crackable offline) and the bypass Token — exposing only whether the
|
||||
// share is password-protected via HasPassword.
|
||||
type shareResponse struct {
|
||||
Hash string `json:"hash"`
|
||||
Path string `json:"path"`
|
||||
UserID uint `json:"userID"`
|
||||
Expire int64 `json:"expire"`
|
||||
HasPassword bool `json:"hasPassword"`
|
||||
}
|
||||
|
||||
func toShareResponse(l *share.Link) *shareResponse {
|
||||
return &shareResponse{
|
||||
Hash: l.Hash,
|
||||
Path: l.Path,
|
||||
UserID: l.UserID,
|
||||
Expire: l.Expire,
|
||||
HasPassword: l.PasswordHash != "",
|
||||
}
|
||||
}
|
||||
|
||||
func toShareResponses(links []*share.Link) []*shareResponse {
|
||||
res := make([]*shareResponse, 0, len(links))
|
||||
for _, l := range links {
|
||||
res = append(res, toShareResponse(l))
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func withPermShare(fn handleFunc) handleFunc {
|
||||
return withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
|
||||
if !d.user.Perm.Share || !d.user.Perm.Download {
|
||||
@@ -38,7 +70,7 @@ var shareListHandler = withPermShare(func(w http.ResponseWriter, r *http.Request
|
||||
s, err = d.store.Share.FindByUserID(d.user.ID)
|
||||
}
|
||||
if errors.Is(err, fberrors.ErrNotExist) {
|
||||
return renderJSON(w, r, []*share.Link{})
|
||||
return renderJSON(w, r, []*shareResponse{})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@@ -52,7 +84,7 @@ var shareListHandler = withPermShare(func(w http.ResponseWriter, r *http.Request
|
||||
return s[i].Expire < s[j].Expire
|
||||
})
|
||||
|
||||
return renderJSON(w, r, s)
|
||||
return renderJSON(w, r, toShareResponses(s))
|
||||
})
|
||||
|
||||
var shareGetsHandler = withPermShare(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
|
||||
@@ -61,21 +93,47 @@ var shareGetsHandler = withPermShare(func(w http.ResponseWriter, r *http.Request
|
||||
err error
|
||||
)
|
||||
if d.user.Perm.Admin {
|
||||
s, err = d.store.Share.GetsByPath(r.URL.Path)
|
||||
s, err = getSharesForAdminPath(d, r.URL.Path)
|
||||
} else {
|
||||
s, err = d.store.Share.Gets(r.URL.Path, d.user.ID)
|
||||
}
|
||||
if errors.Is(err, fberrors.ErrNotExist) {
|
||||
return renderJSON(w, r, []*share.Link{})
|
||||
return renderJSON(w, r, []*shareResponse{})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
return renderJSON(w, r, s)
|
||||
return renderJSON(w, r, toShareResponses(s))
|
||||
})
|
||||
|
||||
func getSharesForAdminPath(d *data, path string) ([]*share.Link, error) {
|
||||
links, err := d.store.Share.All()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
adminPath := filepath.Clean(d.user.FullPath(path))
|
||||
owners := make(map[uint]*users.User)
|
||||
filtered := make([]*share.Link, 0, len(links))
|
||||
for _, link := range links {
|
||||
owner, ok := owners[link.UserID]
|
||||
if !ok {
|
||||
owner, err = d.store.Users.Get(d.server.Root, d.server.FollowExternalSymlinks, link.UserID)
|
||||
if err != nil && !errors.Is(err, fberrors.ErrNotExist) {
|
||||
return nil, err
|
||||
}
|
||||
owners[link.UserID] = owner // owner is nil on ErrNotExist
|
||||
}
|
||||
if owner != nil && filepath.Clean(owner.FullPath(link.Path)) == adminPath {
|
||||
filtered = append(filtered, link)
|
||||
}
|
||||
}
|
||||
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
var shareDeleteHandler = withPermShare(func(_ http.ResponseWriter, r *http.Request, d *data) (int, error) {
|
||||
hash := strings.TrimSuffix(r.URL.Path, "/")
|
||||
hash = strings.TrimPrefix(hash, "/")
|
||||
@@ -176,7 +234,7 @@ var sharePostHandler = withPermShare(func(w http.ResponseWriter, r *http.Request
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
return renderJSON(w, r, s)
|
||||
return renderJSON(w, r, toShareResponse(s))
|
||||
})
|
||||
|
||||
func getSharePasswordHash(body share.CreateBody) (data []byte, statuscode int, err error) {
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
package fbhttp
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/asdine/storm/v3"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/settings"
|
||||
"github.com/filebrowser/filebrowser/v2/share"
|
||||
"github.com/filebrowser/filebrowser/v2/storage/bolt"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
)
|
||||
|
||||
func TestAdminShareGetsHandlerMatchesOwnerScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
root := t.TempDir()
|
||||
ownerScope := filepath.Join(root, "owner")
|
||||
if err := os.MkdirAll(ownerScope, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(ownerScope, "file.txt"), []byte("shared"), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
db, err := storm.Open(filepath.Join(t.TempDir(), "db"))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to open db: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { _ = db.Close() })
|
||||
|
||||
st, err := bolt.NewStorage(db)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get storage: %v", err)
|
||||
}
|
||||
|
||||
owner := &users.User{
|
||||
Username: "owner",
|
||||
Password: "pw",
|
||||
Scope: "/owner",
|
||||
Perm: users.Permissions{Share: true, Download: true},
|
||||
}
|
||||
if err := st.Users.Save(owner); err != nil {
|
||||
t.Fatalf("failed to save owner: %v", err)
|
||||
}
|
||||
|
||||
adminPerm := users.Permissions{Admin: true, Share: true, Download: true}
|
||||
admin := &users.User{
|
||||
Username: "admin",
|
||||
Password: "pw",
|
||||
Scope: "/",
|
||||
Perm: adminPerm,
|
||||
}
|
||||
if err := st.Users.Save(admin); err != nil {
|
||||
t.Fatalf("failed to save admin: %v", err)
|
||||
}
|
||||
|
||||
if err := st.Share.Save(&share.Link{Hash: "h", UserID: owner.ID, Path: "/file.txt"}); err != nil {
|
||||
t.Fatalf("failed to save share: %v", err)
|
||||
}
|
||||
key := []byte("test-signing-key")
|
||||
if err := st.Settings.Save(&settings.Settings{Key: key}); err != nil {
|
||||
t.Fatalf("failed to save settings: %v", err)
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, "/owner/file.txt", http.NoBody)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to construct request: %v", err)
|
||||
}
|
||||
req.Header.Set("X-Auth", signShareTestToken(t, admin.ID, admin.Username, adminPerm, key))
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
handle(shareGetsHandler, "", st, &settings.Server{Root: root}).ServeHTTP(rec, req)
|
||||
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected status 200, got %d: %s", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
var links []*share.Link
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &links); err != nil {
|
||||
t.Fatalf("failed to decode response: %v", err)
|
||||
}
|
||||
if len(links) != 1 || links[0].Hash != "h" {
|
||||
t.Fatalf("expected admin to see owner share h, got %#v", links)
|
||||
}
|
||||
}
|
||||
|
||||
// Regression for the share secret exposure (GHSA-833g-cqhp-h72j): the share API
|
||||
// must not serialize the bcrypt password hash or the bypass token, while still
|
||||
// persisting them server-side so password-protected shares keep working.
|
||||
func TestSharePostHandlerDoesNotLeakSecrets(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
userScope := filepath.Join(root, "user")
|
||||
if err := os.MkdirAll(userScope, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(userScope, "file.txt"), []byte("x"), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
key := []byte("test-signing-key")
|
||||
perm := users.Permissions{Share: true, Download: true}
|
||||
st := scopedUserStorage(t, userScope, perm, key)
|
||||
signed := signToken(t, perm, key)
|
||||
|
||||
body := `{"password":"ShareSecret123!","expires":"24","unit":"hours"}`
|
||||
req, _ := http.NewRequest(http.MethodPost, "/file.txt", strings.NewReader(body))
|
||||
req.Header.Set("X-Auth", signed)
|
||||
rec := httptest.NewRecorder()
|
||||
handle(sharePostHandler, "", st, &settings.Server{Root: root}).ServeHTTP(rec, req)
|
||||
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected 200, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
var resp map[string]any
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("decode: %v", err)
|
||||
}
|
||||
if _, ok := resp["password_hash"]; ok {
|
||||
t.Errorf("VULNERABLE: response leaks password_hash: %s", rec.Body.String())
|
||||
}
|
||||
if _, ok := resp["token"]; ok {
|
||||
t.Errorf("VULNERABLE: response leaks token: %s", rec.Body.String())
|
||||
}
|
||||
if resp["hasPassword"] != true {
|
||||
t.Errorf("expected hasPassword=true, got %v", resp["hasPassword"])
|
||||
}
|
||||
|
||||
// The secrets must still be persisted server-side (storm uses the JSON codec,
|
||||
// so the storage struct's tags must keep emitting them).
|
||||
stored, err := st.Share.GetByHash(resp["hash"].(string))
|
||||
if err != nil {
|
||||
t.Fatalf("share not stored: %v", err)
|
||||
}
|
||||
if stored.PasswordHash == "" || stored.Token == "" {
|
||||
t.Fatalf("server-side secrets not persisted: hash=%q token=%q", stored.PasswordHash, stored.Token)
|
||||
}
|
||||
}
|
||||
|
||||
func signShareTestToken(t *testing.T, id uint, username string, perm users.Permissions, key []byte) string {
|
||||
t.Helper()
|
||||
|
||||
claims := &authToken{
|
||||
User: userInfo{ID: id, Username: username, Perm: perm},
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
IssuedAt: jwt.NewNumericDate(time.Now().Add(-time.Minute)),
|
||||
ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Hour)),
|
||||
},
|
||||
}
|
||||
signed, err := jwt.NewWithClaims(jwt.SigningMethodHS256, claims).SignedString(key)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to sign token: %v", err)
|
||||
}
|
||||
return signed
|
||||
}
|
||||
@@ -110,6 +110,7 @@ func getStaticHandlers(store *storage.Storage, server *settings.Server, assetsFs
|
||||
}
|
||||
|
||||
w.Header().Set("x-xss-protection", "1; mode=block")
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
return handleWithStaticData(w, r, d, assetsFs, "public/index.html", "text/html; charset=utf-8")
|
||||
}, "", store, server)
|
||||
|
||||
@@ -124,6 +125,7 @@ func getStaticHandlers(store *storage.Storage, server *settings.Server, assetsFs
|
||||
|
||||
const maxAge = 86400 // 1 day
|
||||
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%v", maxAge))
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
|
||||
if d.settings.Branding.Files != "" {
|
||||
if strings.HasPrefix(r.URL.Path, "img/") {
|
||||
|
||||
+13
-1
@@ -2,7 +2,9 @@ package fbhttp
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/asticode/go-astisub"
|
||||
@@ -10,6 +12,8 @@ import (
|
||||
"github.com/filebrowser/filebrowser/v2/files"
|
||||
)
|
||||
|
||||
var srtLineBreakTag = regexp.MustCompile(`(?i)<br(?:\s+[^>]*)?\s*/?>`)
|
||||
|
||||
var subtitleHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
|
||||
if !d.user.Perm.Download {
|
||||
return http.StatusAccepted, nil
|
||||
@@ -49,7 +53,11 @@ func subtitleFileHandler(w http.ResponseWriter, r *http.Request, file *files.Fil
|
||||
// load subtitle for conversion to vtt
|
||||
var sub *astisub.Subtitles
|
||||
if strings.HasSuffix(file.Name, ".srt") {
|
||||
sub, err = astisub.ReadFromSRT(fd)
|
||||
content, readErr := io.ReadAll(fd)
|
||||
if readErr != nil {
|
||||
return http.StatusInternalServerError, readErr
|
||||
}
|
||||
sub, err = astisub.ReadFromSRT(bytes.NewReader(normalizeSRTLineBreaks(content)))
|
||||
} else if strings.HasSuffix(file.Name, ".ass") || strings.HasSuffix(file.Name, ".ssa") {
|
||||
sub, err = astisub.ReadFromSSA(fd)
|
||||
}
|
||||
@@ -78,3 +86,7 @@ func subtitleFileHandler(w http.ResponseWriter, r *http.Request, file *files.Fil
|
||||
http.ServeContent(w, r, file.Name, file.ModTime, bytes.NewReader(buf.Bytes()))
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func normalizeSRTLineBreaks(content []byte) []byte {
|
||||
return srtLineBreakTag.ReplaceAll(content, []byte("\n"))
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package fbhttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/files"
|
||||
)
|
||||
|
||||
func TestNormalizeSRTLineBreaks(t *testing.T) {
|
||||
input := []byte("first<br>second<BR/>third<br />fourth<br class=\"x\">fifth")
|
||||
got := string(normalizeSRTLineBreaks(input))
|
||||
want := "first\nsecond\nthird\nfourth\nfifth"
|
||||
if got != want {
|
||||
t.Fatalf("normalizeSRTLineBreaks() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubtitleFileHandlerConvertsSRTBreakTags(t *testing.T) {
|
||||
fs := afero.NewMemMapFs()
|
||||
const path = "/sample.srt"
|
||||
const content = "1\n" +
|
||||
"00:00:01,000 --> 00:00:02,000\n" +
|
||||
"First<br>Second<BR/>Third<br />Fourth\n\n"
|
||||
|
||||
if err := afero.WriteFile(fs, path, []byte(content), 0o644); err != nil {
|
||||
t.Fatalf("failed to write subtitle: %v", err)
|
||||
}
|
||||
info, err := fs.Stat(path)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to stat subtitle: %v", err)
|
||||
}
|
||||
|
||||
file := &files.FileInfo{
|
||||
Fs: fs,
|
||||
Path: path,
|
||||
Name: "sample.srt",
|
||||
ModTime: info.ModTime(),
|
||||
}
|
||||
req := httptest.NewRequest(http.MethodGet, "/api/subtitle/sample.srt?inline=true", http.NoBody)
|
||||
rec := httptest.NewRecorder()
|
||||
|
||||
status, err := subtitleFileHandler(rec, req, file)
|
||||
if err != nil {
|
||||
t.Fatalf("subtitleFileHandler returned error: %v", err)
|
||||
}
|
||||
if status != 0 {
|
||||
t.Fatalf("subtitleFileHandler status = %d, want 0", status)
|
||||
}
|
||||
|
||||
body := rec.Body.String()
|
||||
if strings.Contains(body, "FirstSecond") {
|
||||
t.Fatalf("WebVTT output collapsed SRT <br> tags: %q", body)
|
||||
}
|
||||
if !strings.Contains(body, "First\nSecond\nThird\nFourth") {
|
||||
t.Fatalf("WebVTT output = %q, want converted SRT <br> tags as line breaks", body)
|
||||
}
|
||||
}
|
||||
+26
-3
@@ -109,8 +109,13 @@ func tusPostHandler(cache UploadCache) handleFunc {
|
||||
return http.StatusBadRequest, fmt.Errorf("invalid upload length: %w", err)
|
||||
}
|
||||
|
||||
// Enables the user to utilize the PATCH endpoint for uploading file data
|
||||
cache.Register(file.RealPath(), uploadLength)
|
||||
// Enables the user to utilize the PATCH endpoint for uploading file data.
|
||||
// The removal callback deletes an abandoned upload through the user's
|
||||
// scoped filesystem, so eviction cannot follow a symlink out of scope.
|
||||
uploadPath := r.URL.Path
|
||||
cache.Register(file.RealPath(), uploadLength, func() error {
|
||||
return d.user.Fs.Remove(uploadPath)
|
||||
})
|
||||
|
||||
basePath := "/" + strings.Trim(strings.TrimSpace(d.server.BaseURL), "/")
|
||||
if basePath == "/" {
|
||||
@@ -188,6 +193,10 @@ func tusPatchHandler(cache UploadCache) handleFunc {
|
||||
return http.StatusNotFound, err
|
||||
}
|
||||
|
||||
if uploadOffset > uploadLength {
|
||||
return http.StatusBadRequest, fmt.Errorf("upload offset %d exceeds declared length %d", uploadOffset, uploadLength)
|
||||
}
|
||||
|
||||
// Prevent the upload from being evicted during the transfer
|
||||
stop := keepUploadActive(cache, file.RealPath())
|
||||
defer stop()
|
||||
@@ -215,10 +224,24 @@ func tusPatchHandler(cache UploadCache) handleFunc {
|
||||
}
|
||||
|
||||
defer r.Body.Close()
|
||||
bytesWritten, err := io.Copy(openFile, r.Body)
|
||||
// Enforce the declared Upload-Length: never write more than the bytes
|
||||
// still expected for this upload. Reading one byte past the remainder
|
||||
// lets an over-length body be detected and rejected. Without this bound a
|
||||
// PATCH could stream arbitrary data to disk regardless of the length the
|
||||
// client declared when the upload was created.
|
||||
remaining := uploadLength - uploadOffset
|
||||
bytesWritten, err := io.Copy(openFile, io.LimitReader(r.Body, remaining+1))
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, fmt.Errorf("could not write to file: %w", err)
|
||||
}
|
||||
if bytesWritten > remaining {
|
||||
// The client sent more than it declared; roll this chunk back so the
|
||||
// file stays consistent with the tracked offset, and reject it.
|
||||
if truncErr := openFile.Truncate(uploadOffset); truncErr != nil {
|
||||
return http.StatusInternalServerError, fmt.Errorf("could not truncate file: %w", truncErr)
|
||||
}
|
||||
return http.StatusRequestEntityTooLarge, fmt.Errorf("upload exceeds declared length of %d bytes", uploadLength)
|
||||
}
|
||||
|
||||
// Sync the file to ensure all data is written to storage
|
||||
// to prevent file corruption.
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package fbhttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/settings"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
)
|
||||
|
||||
// A TUS PATCH must not write more than the declared Upload-Length. A client that
|
||||
// declares a small length and then streams a large body must be rejected without
|
||||
// the excess being written to disk, while a correctly-sized upload still works.
|
||||
func TestTusPatchEnforcesUploadLength(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
userScope := filepath.Join(root, "user")
|
||||
if err := os.MkdirAll(userScope, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
key := []byte("test-signing-key")
|
||||
perm := users.Permissions{Create: true, Modify: true}
|
||||
st := scopedUserStorage(t, userScope, perm, key)
|
||||
signed := signToken(t, perm, key)
|
||||
|
||||
cache := newMemoryUploadCache()
|
||||
t.Cleanup(cache.Close)
|
||||
post := handle(tusPostHandler(cache), "", st, &settings.Server{})
|
||||
patch := handle(tusPatchHandler(cache), "", st, &settings.Server{})
|
||||
|
||||
patchReq := func(body string) *httptest.ResponseRecorder {
|
||||
req, _ := http.NewRequest(http.MethodPatch, "/file.txt", strings.NewReader(body))
|
||||
req.Header.Set("X-Auth", signed)
|
||||
req.Header.Set("Content-Type", "application/offset+octet-stream")
|
||||
req.Header.Set("Upload-Offset", "0")
|
||||
rec := httptest.NewRecorder()
|
||||
patch.ServeHTTP(rec, req)
|
||||
return rec
|
||||
}
|
||||
|
||||
// Create an upload that declares only 5 bytes.
|
||||
reqPost, _ := http.NewRequest(http.MethodPost, "/file.txt", http.NoBody)
|
||||
reqPost.Header.Set("X-Auth", signed)
|
||||
reqPost.Header.Set("Upload-Length", "5")
|
||||
recPost := httptest.NewRecorder()
|
||||
post.ServeHTTP(recPost, reqPost)
|
||||
if recPost.Code != http.StatusCreated {
|
||||
t.Fatalf("POST expected 201, got %d body=%q", recPost.Code, recPost.Body.String())
|
||||
}
|
||||
|
||||
// A body far larger than the declared length must be rejected, and nothing
|
||||
// beyond the declared length may reach disk.
|
||||
if rec := patchReq(strings.Repeat("A", 5000)); rec.Code != http.StatusRequestEntityTooLarge {
|
||||
t.Fatalf("over-length PATCH expected 413, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
if fi, err := os.Stat(filepath.Join(userScope, "file.txt")); err != nil {
|
||||
t.Fatalf("stat file.txt: %v", err)
|
||||
} else if fi.Size() > 5 {
|
||||
t.Fatalf("wrote %d bytes despite Upload-Length 5", fi.Size())
|
||||
}
|
||||
|
||||
// A correctly-sized upload still completes.
|
||||
if rec := patchReq("hello"); rec.Code != http.StatusNoContent {
|
||||
t.Fatalf("valid PATCH expected 204, got %d body=%q", rec.Code, rec.Body.String())
|
||||
}
|
||||
if data, _ := os.ReadFile(filepath.Join(userScope, "file.txt")); string(data) != "hello" {
|
||||
t.Fatalf("expected file content \"hello\", got %q", string(data))
|
||||
}
|
||||
}
|
||||
+26
-10
@@ -3,7 +3,6 @@ package fbhttp
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/jellydator/ttlcache/v3"
|
||||
@@ -15,8 +14,11 @@ const uploadCacheTTL = 3 * time.Minute
|
||||
// Allows for different backends (e.g. in-memory or redis)
|
||||
// to support both single instance and multi replica deployments.
|
||||
type UploadCache interface {
|
||||
// Register stores an upload with its expected file size
|
||||
Register(filePath string, fileSize int64)
|
||||
// Register stores an upload with its expected file size. remove is called if
|
||||
// the upload expires before completion, to delete the partial file; it must
|
||||
// route through the uploading user's scoped filesystem so that eviction
|
||||
// cannot follow a symlink out of the user's scope.
|
||||
Register(filePath string, fileSize int64, remove func() error)
|
||||
|
||||
// Complete removes an upload from the cache
|
||||
Complete(filePath string)
|
||||
@@ -31,17 +33,31 @@ type UploadCache interface {
|
||||
Close()
|
||||
}
|
||||
|
||||
// memoryUploadEntry is the value stored for each active upload.
|
||||
type memoryUploadEntry struct {
|
||||
size int64
|
||||
remove func() error
|
||||
}
|
||||
|
||||
// memoryUploadCache is an upload cache for single replica deployments
|
||||
type memoryUploadCache struct {
|
||||
cache *ttlcache.Cache[string, int64]
|
||||
cache *ttlcache.Cache[string, memoryUploadEntry]
|
||||
}
|
||||
|
||||
func newMemoryUploadCache() *memoryUploadCache {
|
||||
cache := ttlcache.New[string, int64]()
|
||||
cache.OnEviction(func(_ context.Context, reason ttlcache.EvictionReason, item *ttlcache.Item[string, int64]) {
|
||||
cache := ttlcache.New[string, memoryUploadEntry]()
|
||||
cache.OnEviction(func(_ context.Context, reason ttlcache.EvictionReason, item *ttlcache.Item[string, memoryUploadEntry]) {
|
||||
if reason == ttlcache.EvictionReasonExpired {
|
||||
fmt.Printf("deleting incomplete upload file: \"%s\"\n", item.Key())
|
||||
os.Remove(item.Key())
|
||||
// Delete through the scoped removal callback rather than a raw
|
||||
// os.Remove on the cached path, so an ancestor directory swapped for
|
||||
// a symlink during the TTL window cannot redirect the delete outside
|
||||
// the user's scope.
|
||||
if remove := item.Value().remove; remove != nil {
|
||||
if err := remove(); err != nil {
|
||||
fmt.Printf("failed to delete incomplete upload file %q: %v\n", item.Key(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
go cache.Start()
|
||||
@@ -49,8 +65,8 @@ func newMemoryUploadCache() *memoryUploadCache {
|
||||
return &memoryUploadCache{cache: cache}
|
||||
}
|
||||
|
||||
func (c *memoryUploadCache) Register(filePath string, fileSize int64) {
|
||||
c.cache.Set(filePath, fileSize, uploadCacheTTL)
|
||||
func (c *memoryUploadCache) Register(filePath string, fileSize int64, remove func() error) {
|
||||
c.cache.Set(filePath, memoryUploadEntry{size: fileSize, remove: remove}, uploadCacheTTL)
|
||||
}
|
||||
|
||||
func (c *memoryUploadCache) Complete(filePath string) {
|
||||
@@ -62,7 +78,7 @@ func (c *memoryUploadCache) GetLength(filePath string) (int64, error) {
|
||||
if item == nil {
|
||||
return 0, fmt.Errorf("no active upload found for the given path")
|
||||
}
|
||||
return item.Value(), nil
|
||||
return item.Value().size, nil
|
||||
}
|
||||
|
||||
func (c *memoryUploadCache) Touch(filePath string) {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package fbhttp
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// On expiry the memory upload cache must delete an abandoned upload through the
|
||||
// registered scoped removal callback, not with a raw os.Remove on the cached
|
||||
// path. This test registers an entry keyed by a real file's path whose callback
|
||||
// does not delete the file; if the old raw os.Remove behaviour were still in
|
||||
// place the file (whose path is the key) would be removed.
|
||||
func TestMemoryUploadCacheEvictionUsesRemovalCallback(t *testing.T) {
|
||||
c := newMemoryUploadCache()
|
||||
t.Cleanup(c.Close)
|
||||
|
||||
f := filepath.Join(t.TempDir(), "partial.upload")
|
||||
if err := os.WriteFile(f, []byte("x"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
var once sync.Once
|
||||
// Deliberately do NOT delete the file here.
|
||||
c.cache.Set(f, memoryUploadEntry{size: 1, remove: func() error {
|
||||
once.Do(func() { close(done) })
|
||||
return nil
|
||||
}}, time.Millisecond)
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(2 * time.Second):
|
||||
t.Fatal("eviction did not invoke the removal callback")
|
||||
}
|
||||
|
||||
if _, err := os.Stat(f); err != nil {
|
||||
t.Fatalf("file at the cache key was deleted, so eviction bypassed the callback (raw os.Remove?): %v", err)
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,9 @@ func (c *redisUploadCache) filePathKey(filePath string) string {
|
||||
return "filebrowser:upload:" + filePath
|
||||
}
|
||||
|
||||
func (c *redisUploadCache) Register(filePath string, fileSize int64) {
|
||||
// Register stores the upload length. The scoped removal callback is unused by
|
||||
// the redis backend, which does not delete partial files on eviction.
|
||||
func (c *redisUploadCache) Register(filePath string, fileSize int64, _ func() error) {
|
||||
err := c.client.Set(context.Background(), c.filePathKey(filePath), fileSize, uploadCacheTTL).Err()
|
||||
if err != nil {
|
||||
log.Printf("failed to register upload in redis cache: %v", err)
|
||||
|
||||
@@ -10,6 +10,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -39,6 +41,33 @@ func (s *Settings) MakeUserDir(username, userScope, serverRoot string) (string,
|
||||
return userScope, nil
|
||||
}
|
||||
|
||||
// CreateUserHome derives and creates the home directory for a user that is
|
||||
// being provisioned (via signup, proxy auth or hook auth) and sets user.Scope
|
||||
// to the resulting path. When CreateUserDir is enabled and the caller did not
|
||||
// supply an explicit scope, the scope is cleared so that MakeUserDir derives a
|
||||
// per-user home from the username instead of falling back to the default scope
|
||||
// (which normalizes to the server root, leaving every provisioned user sharing
|
||||
// it).
|
||||
//
|
||||
// It reports whether the scope was derived from the username. A derived scope
|
||||
// must be persisted with users.Storage.SaveProvisioned, which rejects a scope
|
||||
// already owned by another user so that distinct usernames cannot silently
|
||||
// share one home directory.
|
||||
func (s *Settings) CreateUserHome(user *users.User, serverRoot string, explicitScope bool) (derived bool, err error) {
|
||||
derived = s.CreateUserDir && !explicitScope
|
||||
if derived {
|
||||
user.Scope = ""
|
||||
}
|
||||
|
||||
userHome, err := s.MakeUserDir(user.Username, user.Scope, serverRoot)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
user.Scope = userHome
|
||||
|
||||
return derived, nil
|
||||
}
|
||||
|
||||
func cleanUsername(s string) string {
|
||||
// Remove any trailing space to avoid ending on -
|
||||
s = strings.Trim(s, " ")
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package settings
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
)
|
||||
|
||||
// A user provisioned with CreateUserDir must receive a per-user home directory
|
||||
// derived from its username, not the default scope which normalizes to the
|
||||
// server root.
|
||||
func TestCreateUserHomeDerivesPerUserScope(t *testing.T) {
|
||||
s := &Settings{CreateUserDir: true, UserHomeBasePath: "/users"}
|
||||
|
||||
user := &users.User{Username: "alice", Scope: "."}
|
||||
derived, err := s.CreateUserHome(user, t.TempDir(), false)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if !derived {
|
||||
t.Error("expected the scope to be reported as derived")
|
||||
}
|
||||
if user.Scope != "/users/alice" {
|
||||
t.Errorf("expected derived scope /users/alice, got %q", user.Scope)
|
||||
}
|
||||
}
|
||||
|
||||
// A scope explicitly supplied by the caller (e.g. returned by an auth hook) must
|
||||
// be preserved instead of being replaced by a derived home directory, and must
|
||||
// not be reported as derived: it is legitimate for several users to share it.
|
||||
func TestCreateUserHomePreservesExplicitScope(t *testing.T) {
|
||||
s := &Settings{CreateUserDir: true, UserHomeBasePath: "/users"}
|
||||
|
||||
user := &users.User{Username: "alice", Scope: "/custom"}
|
||||
derived, err := s.CreateUserHome(user, t.TempDir(), true)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if derived {
|
||||
t.Error("an explicit scope must not be reported as derived")
|
||||
}
|
||||
if user.Scope != "/custom" {
|
||||
t.Errorf("explicit scope should be preserved, got %q", user.Scope)
|
||||
}
|
||||
}
|
||||
@@ -110,23 +110,6 @@ func (s *Storage) Gets(path string, id uint) ([]*Link, error) {
|
||||
return links, nil
|
||||
}
|
||||
|
||||
// GetsByPath returns all non-expired links for a path.
|
||||
func (s *Storage) GetsByPath(path string) ([]*Link, error) {
|
||||
links, err := s.All()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filtered := make([]*Link, 0, len(links))
|
||||
for _, link := range links {
|
||||
if link.Path == path {
|
||||
filtered = append(filtered, link)
|
||||
}
|
||||
}
|
||||
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// Save wraps a StorageBackend.Save
|
||||
func (s *Storage) Save(l *Link) error {
|
||||
return s.back.Save(l)
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
package share
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type fakeBackend struct {
|
||||
links []*Link
|
||||
}
|
||||
|
||||
func (f fakeBackend) All() ([]*Link, error) {
|
||||
return f.links, nil
|
||||
}
|
||||
|
||||
func (f fakeBackend) FindByUserID(id uint) ([]*Link, error) {
|
||||
var links []*Link
|
||||
for _, link := range f.links {
|
||||
if link.UserID == id {
|
||||
links = append(links, link)
|
||||
}
|
||||
}
|
||||
return links, nil
|
||||
}
|
||||
|
||||
func (f fakeBackend) GetByHash(hash string) (*Link, error) {
|
||||
for _, link := range f.links {
|
||||
if link.Hash == hash {
|
||||
return link, nil
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f fakeBackend) GetPermanent(path string, id uint) (*Link, error) {
|
||||
for _, link := range f.links {
|
||||
if link.Path == path && link.UserID == id && link.Expire == 0 {
|
||||
return link, nil
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f fakeBackend) Gets(path string, id uint) ([]*Link, error) {
|
||||
var links []*Link
|
||||
for _, link := range f.links {
|
||||
if link.Path == path && link.UserID == id {
|
||||
links = append(links, link)
|
||||
}
|
||||
}
|
||||
return links, nil
|
||||
}
|
||||
|
||||
func (f fakeBackend) Save(_ *Link) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f fakeBackend) Delete(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f fakeBackend) DeleteWithPathPrefix(_ string, _ uint) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestGetsByPathReturnsLinksFromAllUsers(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
expected := []*Link{
|
||||
{Hash: "a", Path: "/file.txt", UserID: 1},
|
||||
{Hash: "b", Path: "/file.txt", UserID: 2},
|
||||
}
|
||||
store := NewStorage(fakeBackend{
|
||||
links: append(expected, &Link{Hash: "c", Path: "/other.txt", UserID: 3}),
|
||||
})
|
||||
|
||||
links, err := store.GetsByPath("/file.txt")
|
||||
if err != nil {
|
||||
t.Fatalf("GetsByPath returned error: %v", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(links, expected) {
|
||||
t.Fatalf("GetsByPath returned %#v, want %#v", links, expected)
|
||||
}
|
||||
}
|
||||
@@ -78,16 +78,17 @@ func (s shareBackend) Delete(hash string) error {
|
||||
}
|
||||
|
||||
func (s shareBackend) DeleteWithPathPrefix(pathPrefix string, userID uint) error {
|
||||
// Share paths are stored without a trailing slash
|
||||
prefix := strings.TrimRight(pathPrefix, "/")
|
||||
|
||||
var links []share.Link
|
||||
if err := s.db.Prefix("Path", pathPrefix, &links); err != nil {
|
||||
if err := s.db.Prefix("Path", prefix, &links); err != nil {
|
||||
if errors.Is(err, storm.ErrNotFound) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
prefix := strings.TrimRight(pathPrefix, "/")
|
||||
|
||||
var err error
|
||||
for _, link := range links {
|
||||
if link.UserID != userID {
|
||||
|
||||
@@ -84,6 +84,44 @@ func TestDeleteWithPathPrefix(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Regression for the trailing-slash delete leaving a stale share
|
||||
// (GHSA-pp88-jhwj-5qh5): deleting "/a/" must remove the exact "/a" share and its
|
||||
// descendants, not just the descendants. Siblings and other users are untouched.
|
||||
func TestDeleteWithPathPrefixTrailingSlash(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
s := newTestShareBackend(t)
|
||||
|
||||
links := []*share.Link{
|
||||
{Hash: "u1-a", Path: "/a", UserID: 1},
|
||||
{Hash: "u1-a-child", Path: "/a/child.txt", UserID: 1},
|
||||
{Hash: "u1-abc", Path: "/abc", UserID: 1}, // sibling sharing a byte prefix
|
||||
{Hash: "u2-a", Path: "/a", UserID: 2}, // other user, must remain
|
||||
}
|
||||
for _, l := range links {
|
||||
if err := s.Save(l); err != nil {
|
||||
t.Fatalf("failed to save link %s: %v", l.Hash, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Delete with a trailing slash, as the resource delete handler does for a
|
||||
// directory request like DELETE /api/resources/a/.
|
||||
if err := s.DeleteWithPathPrefix("/a/", 1); err != nil {
|
||||
t.Fatalf("DeleteWithPathPrefix returned error: %v", err)
|
||||
}
|
||||
|
||||
got := remainingHashes(t, s)
|
||||
want := []string{"u1-abc", "u2-a"}
|
||||
if len(got) != len(want) {
|
||||
t.Fatalf("remaining hashes = %v, want %v", got, want)
|
||||
}
|
||||
for i := range want {
|
||||
if got[i] != want[i] {
|
||||
t.Fatalf("remaining hashes = %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteWithPathPrefixNoMatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
||||
"github.com/asdine/storm/v3"
|
||||
"github.com/asdine/storm/v3/q"
|
||||
bolt "go.etcd.io/bbolt"
|
||||
|
||||
fberrors "github.com/filebrowser/filebrowser/v2/errors"
|
||||
@@ -41,6 +43,23 @@ func (st usersBackend) GetBy(i interface{}) (user *users.User, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (st usersBackend) GetByScope(scope string) (*users.User, error) {
|
||||
user := &users.User{}
|
||||
// Match case-insensitively: on a case-insensitive filesystem two scopes
|
||||
// that differ only in case (e.g. /users/Alice and /users/alice) resolve to
|
||||
// the same home directory, so they must be treated as a collision.
|
||||
pattern := "(?i)^" + regexp.QuoteMeta(scope) + "$"
|
||||
err := st.db.Select(q.Re("Scope", pattern)).First(user)
|
||||
if err != nil {
|
||||
if errors.Is(err, storm.ErrNotFound) {
|
||||
return nil, fberrors.ErrNotExist
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
||||
func (st usersBackend) Gets() ([]*users.User, error) {
|
||||
var allUsers []*users.User
|
||||
err := st.db.All(&allUsers)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package bolt
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/asdine/storm/v3"
|
||||
|
||||
fberrors "github.com/filebrowser/filebrowser/v2/errors"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
)
|
||||
|
||||
// GetByScope must match case-insensitively: on a case-insensitive filesystem
|
||||
// two scopes that differ only in case resolve to the same home directory, so
|
||||
// the provisioning collision check has to treat them as the same scope.
|
||||
func TestGetByScopeCaseInsensitive(t *testing.T) {
|
||||
db, err := storm.Open(filepath.Join(t.TempDir(), "db"))
|
||||
if err != nil {
|
||||
t.Fatalf("open db: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { _ = db.Close() })
|
||||
|
||||
st, err := NewStorage(db)
|
||||
if err != nil {
|
||||
t.Fatalf("new storage: %v", err)
|
||||
}
|
||||
if err := st.Users.Save(&users.User{Username: "CaseVictim", Password: "pw", Scope: "/users/CaseVictim"}); err != nil {
|
||||
t.Fatalf("save: %v", err)
|
||||
}
|
||||
|
||||
for _, scope := range []string{"/users/CaseVictim", "/users/casevictim", "/USERS/CASEVICTIM"} {
|
||||
u, err := st.Users.GetByScope(scope)
|
||||
if err != nil {
|
||||
t.Errorf("GetByScope(%q) unexpected error: %v", scope, err)
|
||||
continue
|
||||
}
|
||||
if u.Username != "CaseVictim" {
|
||||
t.Errorf("GetByScope(%q) returned %q, want CaseVictim", scope, u.Username)
|
||||
}
|
||||
}
|
||||
|
||||
// A genuinely different scope must still miss (and the regex-escaped query
|
||||
// must not match a superstring).
|
||||
for _, scope := range []string{"/users/other", "/users/CaseVictimX"} {
|
||||
if _, err := st.Users.GetByScope(scope); !errors.Is(err, fberrors.ErrNotExist) {
|
||||
t.Errorf("GetByScope(%q) expected ErrNotExist, got %v", scope, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package users
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -10,6 +11,7 @@ import (
|
||||
// StorageBackend is the interface to implement for a users storage.
|
||||
type StorageBackend interface {
|
||||
GetBy(interface{}) (*User, error)
|
||||
GetByScope(scope string) (*User, error)
|
||||
Gets() ([]*User, error)
|
||||
Save(u *User) error
|
||||
Update(u *User, fields ...string) error
|
||||
@@ -20,9 +22,11 @@ type StorageBackend interface {
|
||||
|
||||
type Store interface {
|
||||
Get(baseScope string, followExternalSymlinks bool, id interface{}) (user *User, err error)
|
||||
GetByScope(scope string) (*User, error)
|
||||
Gets(baseScope string, followExternalSymlinks bool) ([]*User, error)
|
||||
Update(user *User, fields ...string) error
|
||||
Save(user *User) error
|
||||
SaveProvisioned(user *User, derivedScope bool) error
|
||||
Delete(id interface{}) error
|
||||
LastUpdate(id uint) int64
|
||||
}
|
||||
@@ -32,6 +36,10 @@ type Storage struct {
|
||||
back StorageBackend
|
||||
updated map[uint]int64
|
||||
mux sync.RWMutex
|
||||
|
||||
// provision serializes the scope-collision check and the save of newly
|
||||
// provisioned users, which must not interleave. See SaveProvisioned.
|
||||
provision sync.Mutex
|
||||
}
|
||||
|
||||
// NewStorage creates a users storage from a backend.
|
||||
@@ -56,6 +64,13 @@ func (s *Storage) Get(baseScope string, followExternalSymlinks bool, id interfac
|
||||
return
|
||||
}
|
||||
|
||||
// GetByScope returns the first user whose scope matches the given one, or
|
||||
// ErrNotExist if none does. The user is returned as stored, without setting up
|
||||
// its filesystem, as it is meant for existence checks rather than serving.
|
||||
func (s *Storage) GetByScope(scope string) (*User, error) {
|
||||
return s.back.GetByScope(scope)
|
||||
}
|
||||
|
||||
// Gets gets a list of all users.
|
||||
func (s *Storage) Gets(baseScope string, followExternalSymlinks bool) ([]*User, error) {
|
||||
users, err := s.back.Gets()
|
||||
@@ -99,6 +114,32 @@ func (s *Storage) Save(user *User) error {
|
||||
return s.back.Save(user)
|
||||
}
|
||||
|
||||
// SaveProvisioned saves a user that is being provisioned (via signup, proxy
|
||||
// auth or hook auth). When its scope was derived from the username, it first
|
||||
// rejects the save if another user already owns that scope, so that distinct
|
||||
// usernames cannot silently share one home directory.
|
||||
//
|
||||
// The check and the save are held under a single lock. Performing them as two
|
||||
// independent operations lets two concurrent provisioning requests both observe
|
||||
// a free scope and both save, leaving two users sharing one home directory.
|
||||
func (s *Storage) SaveProvisioned(user *User, derivedScope bool) error {
|
||||
if !derivedScope {
|
||||
return s.Save(user)
|
||||
}
|
||||
|
||||
s.provision.Lock()
|
||||
defer s.provision.Unlock()
|
||||
|
||||
switch _, err := s.back.GetByScope(user.Scope); {
|
||||
case err == nil:
|
||||
return fberrors.ErrExist
|
||||
case !errors.Is(err, fberrors.ErrNotExist):
|
||||
return err
|
||||
}
|
||||
|
||||
return s.Save(user)
|
||||
}
|
||||
|
||||
// Delete allows you to delete a user by its name or username. The provided
|
||||
// id must be a string for username lookup or a uint for id lookup. If id
|
||||
// is neither, a ErrInvalidDataType will be returned.
|
||||
|
||||
@@ -1,4 +1,117 @@
|
||||
package users
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
fberrors "github.com/filebrowser/filebrowser/v2/errors"
|
||||
)
|
||||
|
||||
// Interface is implemented by storage
|
||||
var _ Store = &Storage{}
|
||||
|
||||
// slowBackend is a minimal StorageBackend whose scope lookup is deliberately
|
||||
// slow, so that an unsynchronized check-then-save reliably interleaves.
|
||||
type slowBackend struct {
|
||||
mu sync.Mutex
|
||||
users []*User
|
||||
delay time.Duration
|
||||
}
|
||||
|
||||
func (b *slowBackend) GetByScope(scope string) (*User, error) {
|
||||
time.Sleep(b.delay)
|
||||
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
for _, u := range b.users {
|
||||
if strings.EqualFold(u.Scope, scope) {
|
||||
return u, nil
|
||||
}
|
||||
}
|
||||
return nil, fberrors.ErrNotExist
|
||||
}
|
||||
|
||||
func (b *slowBackend) Save(u *User) error {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
b.users = append(b.users, u)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *slowBackend) GetBy(interface{}) (*User, error) { return nil, fberrors.ErrNotExist }
|
||||
func (b *slowBackend) Gets() ([]*User, error) { return b.users, nil }
|
||||
func (b *slowBackend) Update(*User, ...string) error { return nil }
|
||||
func (b *slowBackend) DeleteByID(uint) error { return nil }
|
||||
func (b *slowBackend) DeleteByUsername(string) error { return nil }
|
||||
func (b *slowBackend) CountAdmins() (int, error) { return 0, nil }
|
||||
|
||||
// Two usernames that normalize to the same home directory must not both be
|
||||
// provisioned, even when their requests are handled concurrently: checking the
|
||||
// scope and saving the user has to be a single atomic step.
|
||||
func TestSaveProvisionedRejectsConcurrentScopeCollision(t *testing.T) {
|
||||
back := &slowBackend{delay: 50 * time.Millisecond}
|
||||
store := NewStorage(back)
|
||||
|
||||
errs := make([]error, 2)
|
||||
var wg, ready sync.WaitGroup
|
||||
ready.Add(2)
|
||||
for i, username := range []string{"teamone-x", "teamone/x"} {
|
||||
wg.Add(1)
|
||||
go func(i int, username string) {
|
||||
defer wg.Done()
|
||||
// Only start once both goroutines are actually running, so that an
|
||||
// unsynchronized implementation is guaranteed to interleave rather
|
||||
// than to pass by scheduling luck.
|
||||
ready.Done()
|
||||
ready.Wait()
|
||||
errs[i] = store.SaveProvisioned(&User{
|
||||
Username: username,
|
||||
Password: "pw",
|
||||
Scope: "/users/teamone-x",
|
||||
}, true)
|
||||
}(i, username)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
saved := 0
|
||||
for _, err := range errs {
|
||||
switch {
|
||||
case err == nil:
|
||||
saved++
|
||||
case !errors.Is(err, fberrors.ErrExist):
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if saved != 1 {
|
||||
t.Fatalf("VULNERABLE: %d users provisioned into /users/teamone-x, want 1", saved)
|
||||
}
|
||||
if len(back.users) != 1 {
|
||||
t.Fatalf("%d users stored, want 1", len(back.users))
|
||||
}
|
||||
}
|
||||
|
||||
// A scope that was not derived from the username (explicitly configured by an
|
||||
// administrator or returned by an auth hook) may legitimately be shared, so it
|
||||
// must not be subject to the collision check.
|
||||
func TestSaveProvisionedAllowsSharedExplicitScope(t *testing.T) {
|
||||
back := &slowBackend{}
|
||||
store := NewStorage(back)
|
||||
|
||||
for _, username := range []string{"alice", "bob"} {
|
||||
if err := store.SaveProvisioned(&User{
|
||||
Username: username,
|
||||
Password: "pw",
|
||||
Scope: "/shared/team",
|
||||
}, false); err != nil {
|
||||
t.Fatalf("saving %q with an explicit shared scope: %v", username, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(back.users) != 2 {
|
||||
t.Fatalf("%d users stored, want 2", len(back.users))
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,10 @@ The Hook Authentication method in FileBrowser allows developers to delegate user
|
||||
|
||||
The hook’s output controls user permissions, scope, locale, and other attributes, making it a powerful and extensible authentication mechanism.
|
||||
|
||||
> [!WARNING]
|
||||
>
|
||||
> The submitted username and password are attacker-controlled and are handed to your hook command as the `USERNAME` and `PASSWORD` environment variables. File Browser runs the command directly, without a shell, so the values themselves are inert. However, your script must treat them as untrusted: always quote them (`"$USERNAME"`, `"$PASSWORD"`) and never pass them unquoted to a shell, `eval`, `bash -c`, command substitution, or backticks. A hook script that shell-evaluates these values turns any login request into remote code execution.
|
||||
|
||||
For example, the following code delegates filebrowser authentication to a PowerShell script on Windows. You can configure any command (for example, a script in Python, Node.js, etc.).
|
||||
|
||||
```sh
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
## Self-Registration (Signup)
|
||||
|
||||
File Browser allows you to enable user self-registration (signup). This can be enabled via **Settings → Global Settings**, or with `filebrowser config set --signup`. Self-registered users inherit the configured **user defaults**, including the scope.
|
||||
|
||||
> [!WARNING]
|
||||
>
|
||||
> By default, the user scope is the server's root, so a self-registered user could read,
|
||||
> modify, and delete every file File Browser serves. To prevent this, either:
|
||||
>
|
||||
> a. Enable `createUserDir` so each user gets their own directory; or
|
||||
> b. If users are meant to share files, set the default scope to something other than the root.
|
||||
|
||||
## Fail2ban
|
||||
|
||||
File Browser does not natively support protection against brute force attacks. Therefore, we suggest using something like [fail2ban](https://github.com/fail2ban/fail2ban), which takes care of that by tracking the logs of your File Browser instance. For more information on how fail2ban works, please refer to their [wiki](https://github.com/fail2ban/fail2ban/wiki).
|
||||
|
||||
@@ -47,7 +47,7 @@ docker run \
|
||||
|
||||
Where `filebrowser_data`, `filebrowser_database` and `filebrowser_config` are Docker [volumes](https://docs.docker.com/engine/storage/volumes/), where the data, database and configuration will be stored, respectively. The default configuration and database will be automatically initialized.
|
||||
|
||||
The default user that runs File Browser inside the container has PID 1000 and GID 1000. If, for one reason or another, you want to run the Docker container with a different user, please consult Docker's [user documentation](https://docs.docker.com/engine/containers/run/#user).
|
||||
The default user that runs File Browser inside the container has UID 1000 and GID 1000. If, for one reason or another, you want to run the Docker container with a different user, please consult Docker's [user documentation](https://docs.docker.com/engine/containers/run/#user).
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user