diff options
Diffstat (limited to 'lib/models/FileRef.php')
| -rw-r--r-- | lib/models/FileRef.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/models/FileRef.php b/lib/models/FileRef.php index 2a7f485..4196367 100644 --- a/lib/models/FileRef.php +++ b/lib/models/FileRef.php @@ -299,7 +299,6 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange return mb_strpos($this->mime_type, 'audio/') === 0; } - /** * Determines if the FileRef references a video file. * @@ -311,6 +310,22 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange } /** + * Get the preferred content disposition of this file. + */ + public function getContentDisposition(): string + { + if ($this->isImage() || $this->isAudio() || $this->isVideo()) { + return 'inline'; + } + + if (in_array($this->mime_type, ['application/pdf', 'text/plain'])) { + return 'inline'; + } + + return 'attachment'; + } + + /** * Export available data of a given user into a storage object * (an instance of the StoredUserData class) for that user. * |
