1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-10-05 12:13:23 +02:00

[ticket/14285] Use route service for download routes

PHPBB3-14285
This commit is contained in:
rubencm
2021-03-21 21:46:56 +01:00
parent f66c1d9e1e
commit c375f2c9e5
12 changed files with 106 additions and 49 deletions

View File

@@ -1073,6 +1073,7 @@ class bbcode_firstpass extends bbcode
if ($pos_domain !== false && $pos_path >= $pos_domain && $pos_ext >= $pos_path)
{
// Ok, actually we allow linking to some files (this may be able to be extended in some way later...)
// @deprecated
if (strpos($url, '/' . $check_path . '/download/file.' . $phpEx) !== 0)
{
return false;
@@ -1534,6 +1535,8 @@ class parse_message extends bbcode_firstpass
global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request;
global $phpbb_container, $phpbb_dispatcher;
$controller_helper = $phpbb_container->get('controller.helper');
$error = array();
$num_attachments = count($this->attachment_data);
@@ -1776,7 +1779,7 @@ class parse_message extends bbcode_firstpass
if (isset($this->plupload) && $this->plupload->is_active())
{
$download_url = append_sid("{$phpbb_root_path}download/file.{$phpEx}", 'mode=view&id=' . $new_entry['attach_id']);
$download_url = $controller_helper->route('phpbb_storage_attachment', ['id' => (int) $new_entry['attach_id']]);
// Send the client the attachment data to maintain state
$json_response->send(array('data' => $this->attachment_data, 'download_url' => $download_url));