Repository navigation
Add a server-wide maximum file lifetime (GOKAPI_MAX_EXPIRY_SECONDS) - #440
Open
D3strukt0r wants to merge 1 commit into
Open
D3strukt0r wants to merge 1 commit into
D3strukt0r wants to merge 1 commit into
Conversation
1 task
D3strukt0r
force-pushed
the
feat/max-expiry
branch
from
November 15, 2026 20:12
b68142a to
b7434db
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #265. cc @Forceu, and @i0rt and @Str00pwafel, who asked for this in #265.
Adds
GOKAPI_MAX_EXPIRY_SECONDS, a server-wide maximum lifetime for files in seconds (0 or unset = no limit, behaviour unchanged). When it is set:ExpiryTooLong:/chunk/complete,/files/add,/files/modifyand/files/duplicate. Admins included.expiryDaysis refused, so the copy can't outlive the limit./info/configreportsMaxExpirySeconds. gokapi-cli uses it: when the server has a maximum and--expiry-daysisn't given, it leaves the expiry out so the server default applies instead of sending "unlimited". Without a maximum the CLI behaves as before.The check lives in one place,
fileupload.CheckMaxExpiry, withCapToMaxExpiryfor expiries the uploader didn't choose. The setting is environment-only likeGOKAPI_MAX_SIZE_GUESTUPLOAD, so there is no config or database change. Existing files keep their expiry when the maximum is switched on.This probably conflicts with your draft #405 in
routing.go,FileUpload.goandApi.go; happy to rebase onto it if you'd rather merge that first.Screenshots (
GOKAPI_MAX_EXPIRY_SECONDS=1209600, 14 days)Upload page: the expiry can't be switched off and is limited to 14 days.
Edit dialog: no "unlimited" option, the calendar ends at the maximum.
Type of Change
Technical Details
How Has This Been Tested?
GOKAPI_MAX_EXPIRY_SECONDS=3600and local storage: uploads withexpiryDays=0and30refused with 400, withoutexpiryDaysexpiring after one hour; editing to unlimited refused; duplicating an unlimited file withoutexpiryDaysrefused; a guest upload through a file request expires after one hour; gokapi-cli without--expiry-daysworks; admin upload page and edit dialog checked in Chrome (also with a 14-day maximum, see screenshots). With the variable unset everything behaves as before (unlimited uploads, 14-day default, unlimited guest uploads).go test ./... -parallel 8with the CI tag setstest,awsmock,test,noaws,test,noaws,integrationandtest,awstest, all passing (12 new tests each).golang:1.26) on macOSChecklist