Concepts

Resources

Files stored by the database: images, scripts, web part packages and forms.

Resources are raw files stored by the database next to the data: images, stylesheets, JavaScript modules, assemblies and documents. Forms and web part packages are kept as resources too.

Paths and access

A resource has a path, such as images/logo.png, and an access setting:

AccessWho can read it
signed-inAnyone signed in. The default for a new file.
publicAnyone, without signing in.
  • Anyone signed in can upload a new file. Only its uploader, or a System Admin, can replace, re-share or delete it.
  • Case is ignored, and a resource keeps the spelling of its first upload.
  • Path segments are ASCII letters, digits, ., -, _ and ~, up to 128 characters each, 16 segments and 512 characters in all. A segment can't be empty, . or .., start or end with ., or be a Windows device name.
  • A file and a folder can't have the same name.

Reserved folders

FolderWritten by
webparts/Web part package installs only, including OmniCore's own packages at start-up.
forms/The forms API only.

Uploads and deletes there are refused, though the files can be read like any others.

Serving

Responses carry the file's type from its extension, a strong ETag (its SHA-256 hash), and Last-Modified. If-None-Match answers 304 and Range answers 206. Every response has X-Content-Type-Options: nosniff and a sandboxing Content Security Policy, and binaries, executables and HTML are sent as attachments, so an uploaded page can't run as part of the site.

Limits

SettingDefault
MaxFileBytes64 MB a file (413 above it).
MaxTotalBytesNo limit. Uploads are refused with 507 once all resources together would pass it.
MaxBytesPerUserNo limit. Uploads are refused with 507 once one user's resources would pass it. System Admins are exempt.

See Configuration.

Files by hand

At start-up the catalogue is checked against the Resources/ folder, so files can be copied in or removed by hand: a new file is added as signed-in with no uploader (only a System Admin can change it), a missing file's entry is dropped, and a changed file is hashed again.

Working with resources

  • With occtl: occtl resource put images/ .\logo.png --access public.
  • With the .NET connector's resource calls.
  • With the API: PUT /api/resources/{path} with the raw file as the body. See REST API: resources.

Resources have no history: replacing a file discards the old one. Put a version in the path to keep several.