[Posting] Respect process_links setting

This commit is contained in:
Diogo Peralta Cordeiro 2021-08-19 19:18:33 +01:00 committed by Hugo Sales
parent ab142ab52d
commit 9739cc5f21
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 17 additions and 15 deletions

View File

@ -26,7 +26,6 @@ use App\Core\DB\DB;
use App\Core\Event; use App\Core\Event;
use App\Core\Form; use App\Core\Form;
use App\Core\GSFile; use App\Core\GSFile;
use App\Util\Exception\ClientException;
use function App\Core\I18n\_m; use function App\Core\I18n\_m;
use App\Core\Modules\Component; use App\Core\Modules\Component;
use App\Entity\Attachment; use App\Entity\Attachment;
@ -36,6 +35,7 @@ use App\Entity\Link;
use App\Entity\Note; use App\Entity\Note;
use App\Entity\NoteToLink; use App\Entity\NoteToLink;
use App\Util\Common; use App\Util\Common;
use App\Util\Exception\ClientException;
use App\Util\Exception\InvalidFormException; use App\Util\Exception\InvalidFormException;
use App\Util\Exception\RedirectException; use App\Util\Exception\RedirectException;
use InvalidArgumentException; use InvalidArgumentException;
@ -143,6 +143,7 @@ END;
DB::flush(); DB::flush();
} }
if (Common::config('attachments', 'process_links')) {
$matched_urls = []; $matched_urls = [];
$processed_urls = false; $processed_urls = false;
preg_match_all(self::URL_REGEX, $content, $matched_urls, PREG_SET_ORDER); preg_match_all(self::URL_REGEX, $content, $matched_urls, PREG_SET_ORDER);
@ -159,6 +160,7 @@ END;
DB::flush(); DB::flush();
} }
} }
}
/** /**
* Get a unique representation of a file on disk * Get a unique representation of a file on disk