precheck

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBookId

func IsBookId(code string) string

func ValidateFiles

func ValidateFiles(ctx context.Context, testament request.Testament, files []generic.InputFile) ([]generic.InputFile, *log.Status)

func ValidateFilesWASM

func ValidateFilesWASM(req *request.Request, paths string, isSFM bool) []string

ValidateFilesWASM takes the relative file paths found in a dropped directory (root directory name included as the prefix, matching what gets uploaded to the arti-input bucket), JSON-encoded as an array of strings (parsed by parseJSONStringArray below rather than encoding/json+reflect, to keep the WASM build's binary size down - see json_map.go in request/validate for the same pattern). An earlier version NUL-joined the paths instead; that was dropped after confirming (via a real browser session vs. an identical wasm binary run under Node) that an embedded NUL byte in the JS string does not reliably survive the syscall/js crossing in at least one real browser, even though it round-trips fine through pure JS join/split on the JS side. JSON's \uXXXX-style escaping avoids embedding any raw control byte in the string that crosses the boundary. isSFM selects which text format to look for (.sfm files when true, .usx when false), mirroring the form's text_format_sfm/text_format_usx radio choice.

It checks that each filename is recognized - setMediaType identifies the media type from its name/extension, and parseFilenames confirms the naming convention parses (book id, chapter, etc.) - without looking at file contents, using req.Testament to prune books the request didn't ask for. On success it writes a glob pattern covering the matched files (e.g. s3://arti-input/MyFolder/audio/*.mp3) into req.AudioData.AWSS3 and req.TextData.AWSS3; the full InputFile-level processing this package also does (unzip, setMediaType, parseFilenames) happens again for real once the files are uploaded and the server picks up the request.

Returns one message per problem file; an empty slice means every file in the tree was understood.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL