When two people change the same file
Filezar checks the state you read before accepting a rename, move, or replacement. If another operation changed that File or Folder, your request receives HTTP 409 Conflict. Refresh the item, review what changed, and decide whether to try again.
Pre-release: this guide describes the implementation in the repository. Check your deployment's version and OpenAPI document before using an endpoint. The first Filezar API compatibility promise has not started. Product UI endpoints, including replacement from another File, are not covered by that promise.
What Filezar protects
| Operation | What happens when operations overlap |
|---|---|
| Rename or move the same File or Folder | A request based on an older state is refused with 409. |
| Save Folder Content Permissions in Console | If the Folder changed after the page loaded, the save is refused with 409. Reload the permissions and review them before saving again. |
| Update searchable File metadata | The last-read File token is required. A real change advances it without creating a content revision. An active write or stale token receives 409. |
| Replace the same File twice | The first accepted reservation owns the replacement. Another replacement receives 409 before its bytes are transferred to the S3 backend. |
| Rename or move a File during replacement | The active write blocks the change. After completion, use its returned token or read the current File state. |
| Move a Folder containing an active upload, copy, or replacement | The move is refused while the write reservation is active. |
| Repeat a rename or move that would change nothing | It succeeds only with the current token. It creates no extra management event. |
These checks do not lock a document while someone edits it in another application. They protect Filezar's catalog changes and publication of new content. Filezar does not merge two people's document edits.
Read, then send the token
File and Folder reads and child listings include concurrencyToken, an opaque GUID. Keep the value with
the item you display. Send that same value in a rename, move, or replacement request.
For example, read GET /api/v1/files/{fileId}, then send its token with
PUT /api/v1/files/{fileId}/rename. The request body is:
{
"name": "Quarterly report.pdf",
"concurrencyToken": "019940c1-33d0-7a00-8100-000000000001"
}
Use the token returned by your deployment, not the example value. A missing, empty, or malformed token
receives 400 Bad Request. For a streamed replacement, send the concurrencyToken metadata part before
the file part, alongside the required sizeBytes field. For replacement from another File, send the
target File's token with sourceFileId.
A token changes when that item's editable state, placement, lifecycle, or current content changes. Moving a Folder also changes its descendant Folders' tokens. Derived Folder size totals, content activity dates, and effective-policy rebuilds do not by themselves change its token. Permissions and quotas are checked separately on every operation; a current token grants no access.
Rename and Move return 200 OK with the resulting item ID, Space ID, name, location, and
concurrencyToken. File responses use folderId; Folder responses use parentFolderId. Keep the
returned token with the returned state for the next edit. No extra read is needed just to get that token.
An unchanged name or destination returns the current state with the same token.
Explorer uses the returned name and token immediately. It can still refresh a listing to update sorting, filtering, ancestor paths, and derived dates. Folder moves also change descendant Folder tokens, so a client holding those descendants should refresh their state before editing them.
The one-call Filezar API replacement endpoint is POST /api/v1/files/{fileId}/replace. It returns
fileId, version, and concurrencyToken from the successfully published revision. Keep that token
for the next edit; no extra GET is needed just to obtain it. The token is saved with the revision and
returned only after publication commits. After authentication, CSRF, and current permission checks succeed, a keyed retry returns the original
version and token even if a later edit has changed the File. Revoked access can instead produce an
authorization error; see the
Filezar API retry guide. Explorer reads this result and can still refresh to update revision
metadata and derived dates. Replacement from another File remains Product UI with its existing response.
External OIDC Clients can authenticate with access JWTs (gh:67). Cookie mutations retain CSRF
protection; successfully selected bearer mutations are exempt (gh:361). Local/ActiveDirectory
token issuance remains planned under gh:297.
Do not fetch a new token just to silently resubmit an old decision. Explorer keeps the displayed token with rename, cut/paste, and replacement actions. On a conflict, it shows the refusal and refreshes the affected listing. Review the new state before starting another operation.
Three values with different jobs
| Value | Purpose |
|---|---|
concurrencyToken |
Detect changes to catalog state before an edit. It is a change marker, not a credential. |
version |
Identify a Filezar content revision. A rename or move does not create a new content revision. |
s3VersionId |
Carry an opaque version or ETag-derived marker from the S3 backend. It is not the catalog concurrency token. |
The concurrency check does not depend on native S3 versioning or Redis. It uses the catalog database. The same file-content rules apply across supported S3 backends: rename and move do not copy or delete objects, and each replacement writes to a separate object key.
A replacement becomes visible only after publication
Filezar first reserves the destination and any positive growth in current-revision quota. The reservation records the accepted token and content revision. Only then does Filezar transfer the incoming bytes or start the object copy for a replacement from another File.
After transfer, Filezar checks the reservation, current File state, destination, and permissions again. Publication records the new revision, current File metadata, quota totals, management event, and any idempotency receipt in one catalog transaction. Cached reads are invalidated after commit. Readers keep seeing the previous committed revision until publication succeeds.
The catalog database and S3 backend do not share a transaction. A failed, cancelled, or expired transfer can leave an unpublished object temporarily. Filezar records cleanup work, fences the old writer so it cannot publish, and releases its reservation. Expiry cleanup is asynchronous; an expired reservation can continue to block a new write until the cleanup worker fences it. Cleanup targets that operation's uncommitted object key and preserves published revision objects.
Recovering from a conflict or a lost response
For 409, read the response's explanation. Another person may have changed the item, a replacement may still be active, or a destination name may already be taken. Refresh, wait for or cancel your active transfer when appropriate, then choose what to do using the current state.
If the response was lost and an endpoint supports Idempotency-Key, repeat the same request with the
same key and token to recover its recorded result. A completed replay does not run the mutation again.
Changing the token changes the request fingerprint. After reviewing fresh state, a new attempt needs a
new idempotency key. See the repository's
Filezar API retry guide.
Scope and deployment notes
- This is protection for concurrent changes to the same item. A database constraint preventing every simultaneous live-sibling File-name collision is separate work; do not assume global name uniqueness.
- The current resumable-upload API creates new Files. A resumable replacement workflow is separate work.
- SQL Server is the current deployment database provider. SQLite is covered by the isolated catalog validation matrix. PostgreSQL runtime configuration and migrations remain planned.
- Before upgrading to the concurrency-token schema, stop admission of new writes and drain or cancel active replacements. The migration refuses to proceed while an unreleased legacy replacement exists. It initializes tokens without rewriting customer objects. All application instances must run the matching version; do not run old writers against the new schema.
The repository roadmap tracks the remaining work. This page makes no claim that planned capabilities are available in a released deployment.