$ns = new AttachmentNoticeSection($this);
$ns->show();
}
+
+ public function sendFile(string $filepath) {
+ if (common_config('site', 'use_x_sendfile')) {
+ header('X-Sendfile: ' . $filepath);
+ } else {
+ $filesize = $this->attachment->size;
+ // 'if available', it says, so ensure we have it
+ if (empty($filesize)) {
+ $filesize = filesize($filepath);
+ }
+ header("Content-Length: {$filesize}");
+ // header('Cache-Control: private, no-transform, no-store, must-revalidate');
+
+ $ret = @readfile($filepath);
+
+ if ($ret === false || $ret !== $filesize) {
+ common_log(LOG_ERR, "The lengths of the file as recorded on the DB (or on disk) for the file " .
+ "{$filepath}, with id={$this->attachment->id} differ from what was sent to the user.");
+ }
+ }
+ }
}
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header('Expires: 0');
header('Content-Transfer-Encoding: binary'); // FIXME? Can this be different?
- $filesize = $this->attachment->size;
- // 'if available', it says, so ensure we have it
- if (empty($filesize)) {
- $filesize = filesize($this->attachment->filename);
- }
- header("Content-Length: {$filesize}");
- // header('Cache-Control: private, no-transform, no-store, must-revalidate');
- $ret = @readfile($filepath);
-
- if ($ret === false || $ret !== $filesize) {
- common_log(LOG_ERR, "The lengths of the file as recorded on the DB (or on disk) for the file " .
- "{$filepath}, with id={$this->attachment->id} differ from what was sent to the user.");
- }
+ $this->sendFile($filepath);
}
}
if (!defined('GNUSOCIAL')) { exit(1); }
/**
- * Download notice attachment
+ * View notice attachment
*
- * @category Personal
* @package GNUsocial
- * @author Mikael Nordfeldth <mmn@hethane.se>
+ * @author Miguel Dantas <biodantasgs@gmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link https:/gnu.io/social
*/
class Attachment_viewAction extends AttachmentAction
{
header("Content-Disposition: attachment; filename=\"{$filename}\"");
}
header('Expires: 0');
- header('Content-Transfer-Encoding: binary'); // FIXME? Can this be different?
- $filesize = $this->attachment->size;
- // 'if available', it says, so ensure we have it
- if (empty($filesize)) {
- $filesize = filesize($this->attachment->filename);
- }
- header("Content-Length: {$filesize}");
- // header('Cache-Control: private, no-transform, no-store, must-revalidate');
-
- $ret = @readfile($filepath);
+ header('Content-Transfer-Encoding: binary');
- if ($ret === false || $ret !== $filesize) {
- common_log(LOG_ERR, "The lengths of the file as recorded on the DB (or on disk) for the file " .
- "{$filepath}, with id={$this->attachment->id} differ from what was sent to the user.");
- }
+ $this->sendFile($filepath);
}
}
define('GNUSOCIAL_ENGINE', 'GNU social');
define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
-define('GNUSOCIAL_BASE_VERSION', '1.24.0');
+define('GNUSOCIAL_BASE_VERSION', '1.24.1');
define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);