Merged
Conversation
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.
This pull request introduces several improvements and bug fixes related to token validation, file sharing, and upload management in the backend FastAPI application. The most significant changes include stricter and more consistent token status checks (including admin bypass), enhanced support for public media sharing with bot detection and OpenGraph previews, improvements to upload token handling, and timezone-aware database fields.
Token validation and admin bypass:
get_file_infoanddownload_fileendpoints, with an explicit admin bypass allowing admins to access files even if the token is expired or disabled. [1] [2] [3] [4]get_tokenendpoint, so token metadata can be queried even if the token is expired or disabled.Public sharing and OpenGraph preview:
/f/{token}route that detects bots (e.g., Discord, Twitter) via theUser-Agentheader and serves a Jinja2-rendered OpenGraph preview page for public media sharing, improving link previews on social platforms. [1] [2] [3]Upload token and record management:
_ensure_tokenhelper is extended to accept either a token value or token ID, and is now used throughout upload-related endpoints to consistently validate token status (including for TUS protocol endpoints and upload completion). [1] [2] [3] [4] [5] [6] [7]Database and model improvements:
created_atandcompleted_atfields inUploadTokenandUploadRecordmodels are now timezone-aware (DateTime(timezone=True)), ensuring correct handling of timestamps. [1] [2]Documentation and minor fixes:
is_adminparameter and clarifying token info endpoint descriptions. [1] [2] [3]These changes collectively improve security, reliability, and user experience for file sharing and upload management in the application.