Admin Guide: File Name Sanitation

File names are sanitised to ensure they are valid for use in S3 buckets. This is important for maintaining compatibility with S3's naming rules and preventing issues with file retrieval.

For simplicity, we use the same rules for both S3 bucket names and object names within those buckets. These rules are applied automatically by the system when files are uploaded, either through the UI forms or via the background import process.

Rules

Only the following characters are allowed in bucket and object names:

  • Lowercase letters: a-z
  • Numbers: 0-9
  • Dots: .
  • Hyphens: -
  • Single Spaces: (but these are stripped from the beginning and end of the name)

Other rules:

  • Names must be lower-case
  • Names must begin and end with a lower-case letter or number
  • Names must not begin with this restricted prefix: sthree-
  • Names must not end with this restricted suffix: -s3alias

Therefore, when sanitising bucket or object names, the following actions are applied:

  • Blank spaces at the start or end of the name are stripped.
  • Any characters other than a-z, 0-9, . or - are removed.
  • Multiple consecutive spaces are replaced with a single space.
  • Multiple consecutive hyphens are replaced with a single hyphens.
  • Characters other than a-z, 0-9 at the start or end of a name are removed.
  • The name is converted to lowercase.
  • The prefix sthree-, if present, is removed.
  • The suffix -s3alias, if present, is removed.