1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-18 19:14:03 +00:00
akkoma/lib/pleroma/uploaders
Martin Kühl f77ec96707 Uploaders.S3: Replace unsafe characters in object key
According to [the S3 docs][s3], the characters safe for use in object keys are:

* 0-9
* a-z
* A-Z
* !
* -
* _
* .
* *
* '
* (
* )

(The / character is not listed but mentioned being safe outside of the list.)

Several characters that are valid in filenames can cause problems, for example
spaces are not valid in URLs and need to be escaped,
sequences of spaces can become squeezed by S3,
some characters like \ are documented to require “significant special handling”.

To avoid these problems, this change encodes the filename
before using it as part of the S3 object name
by replacing all characters except those documented as “safe” with dashes.

[s3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
2018-09-24 15:38:32 +02:00
..
swift Add backend failure handling with :ok | :error so the uploader can handle it. 2018-08-29 22:07:28 -03:00
local.ex [Pleroma.Uploaders.Local]: Add configuration for custom url path 2018-09-02 19:00:16 +02:00
s3.ex Uploaders.S3: Replace unsafe characters in object key 2018-09-24 15:38:32 +02:00
uploader.ex increase uploader behaviour documentation accuracy. 2018-08-30 09:20:29 -03:00