[UI] Add mechanism for rendering note contents in different formats. Implement plaintext rendering. Use rendered field for note content, rather than the content itself

This commit is contained in:
2021-09-14 13:40:50 +01:00
committed by Diogo Peralta Cordeiro
parent f344ed376c
commit 8f0a3e4977
16 changed files with 793 additions and 116 deletions

View File

@@ -30,7 +30,8 @@ use App\Util\Exception\DuplicateFoundException;
use App\Util\Exception\NotFoundException;
use DateTimeInterface;
use InvalidArgumentException;
use Symfony\Component\HttpClient\Exception\ClientException;
use Symfony\Component\HttpClient\Exception\ClientException as HTTPClientException;
use Symfony\Component\HttpClient\Exception\TransportException;
/**
* Entity for representing a Link
@@ -144,12 +145,12 @@ class Link extends Entity
// Forbidden
throw new InvalidArgumentException(message: "A Link can't point to a local location ({$url}), it must be a remote one", code: 400);
}
$head = HTTPClient::head($url);
// This must come before getInfo given that Symfony HTTPClient is lazy (thus forcing curl exec)
try {
$head = HTTPClient::head($url);
// This must come before getInfo given that Symfony HTTPClient is lazy (thus forcing curl exec)
$headers = $head->getHeaders();
// @codeCoverageIgnoreStart
} catch (ClientException $e) {
} catch (HTTPClientException | TransportException $e) {
throw new InvalidArgumentException(previous: $e);
// @codeCoverageIgnoreEnd
}