Input validation work and error handling
This commit is contained in:
1 parent
4e2520ee76
commit
554b7cc82c
20 files changed
+627
-96
No files matched your search
@@ -96,13 +96,36 @@ extensions or URL schemes; no schema changes are required.
|
||||
As with uploads, keep this interface on a trusted network until authentication
|
||||
and broader access controls are implemented.
|
||||
|
||||
## Submission validation
|
||||
|
||||
All new image, video, stream, and YouTube submissions require a nonblank media
|
||||
name of at most 120 characters, without control characters. Surrounding spaces
|
||||
are removed. Names must be unique across the media catalog and pending or
|
||||
currently downloading YouTube jobs, compared case-insensitively after Unicode
|
||||
normalization and trimming. Failed jobs do not reserve names; completed jobs
|
||||
normally have a catalog entry that does. Existing records are not renamed or
|
||||
removed. This rule is enforced by the app and worker when writing under SQLite
|
||||
transactions, not by a database constraint; direct SQL can bypass it.
|
||||
|
||||
Stream registration accepts HTTP, HTTPS, RTSP, RTMP, RTMPS, UDP, and TCP network
|
||||
URLs, including local-network hosts. YouTube requests require a supported
|
||||
individual video URL. Validation checks syntax, not network reachability.
|
||||
|
||||
Image and video uploads require **FFprobe and FFmpeg on PATH** for local-only,
|
||||
time-limited content validation. Extensions and client MIME types alone are not
|
||||
trusted; a video stream and a decodable first frame are required. Full files are
|
||||
not decoded or scanned for malware. Missing validation tools, storage issues,
|
||||
database failures, and invalid fields produce user-facing errors without saving
|
||||
an incomplete media entry. Retrying a failed upload starts it from the beginning.
|
||||
|
||||
## Uploading local videos
|
||||
|
||||
Use **Upload a Video** on the home page, or visit `/upload/video`. Enter a display
|
||||
name and select one video. The limit is 5GB (5 × 1024³ bytes), checked both in the
|
||||
browser and on the server. Common formats including MP4, MKV, MOV, WebM, AVI,
|
||||
MPEG, and WMV are accepted by extension; the upload does not transcode or inspect
|
||||
video codecs.
|
||||
MPEG, and WMV are accepted by extension. Before saving, FFprobe checks for a
|
||||
video stream and FFmpeg decodes its first frame; the upload does not transcode the
|
||||
file or guarantee the rest of the video is valid.
|
||||
|
||||
The page displays transfer progress and warns against navigating away. At 100%,
|
||||
wait for the server to finish saving; only then will the page automatically
|
||||
@@ -125,8 +148,9 @@ space for both Flask's temporary upload and the final video file.
|
||||
|
||||
Use **Upload a Static Image** on the home page, or visit `/upload/photo`. Enter
|
||||
an image name and choose one JPG/JPEG, PNG, WebP, BMP, TIFF, or GIF file. Files
|
||||
are accepted by extension; this workflow does not decode the image or check for
|
||||
animation. SVG and other active-content formats are not accepted.
|
||||
are checked against their extensions and decoded for validation. Images may be
|
||||
animated, but only the first frame is checked; dimensions are limited to 50
|
||||
megapixels. SVG and other active-content formats are not accepted.
|
||||
|
||||
Image uploads now use `"image_upload_location": "Images"` in `config.json`,
|
||||
relative to that file. The folder is created automatically when saving an upload
|
||||
@@ -238,5 +262,5 @@ WHERE youtube_download_job_id = 123
|
||||
Run the database and worker tests without downloading any videos:
|
||||
|
||||
```sh
|
||||
python3 -m unittest test.youtube_download_job_test test.youtube_download_web_test test.upload_video_test test.upload_photo_test test.player_test test.media_library_test -v
|
||||
python3 -m unittest test.youtube_download_job_test test.youtube_download_web_test test.upload_video_test test.upload_photo_test test.player_test test.media_library_test test.submission_validation_test -v
|
||||
```
|
||||
Reference in new issue
Block a user