1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Merge remote-tracking branch 'origin/master' into 2.6.0

This commit is contained in:
Jeremy Benoist 2022-11-03 10:30:17 +01:00
commit 8d3fcd4635
No known key found for this signature in database
GPG key ID: 7168D5DD29F38552
18 changed files with 606 additions and 318 deletions

View file

@ -2,6 +2,7 @@
namespace Wallabag\CoreBundle\Helper;
use enshrined\svgSanitize\Sanitizer;
use GuzzleHttp\Psr7\Uri;
use GuzzleHttp\Psr7\UriResolver;
use Http\Client\Common\HttpMethodsClient;
@ -146,6 +147,32 @@ class DownloadImages
$hashImage = hash('crc32', $absolutePath);
$localPath = $folderPath . '/' . $hashImage . '.' . $ext;
$urlPath = $this->wallabagUrl . '/assets/images/' . $relativePath . '/' . $hashImage . '.' . $ext;
// custom case for SVG (because GD doesn't support SVG)
if ('svg' === $ext) {
try {
$sanitizer = new Sanitizer();
$sanitizer->minify(true);
$sanitizer->removeRemoteReferences(true);
$cleanSVG = $sanitizer->sanitize((string) $res->getBody());
// add an extra validation by checking about `<svg `
if (false === $cleanSVG || false === strpos($cleanSVG, '<svg ')) {
$this->logger->error('DownloadImages: Bad SVG given', ['path' => $imagePath]);
return false;
}
file_put_contents($localPath, $cleanSVG);
return $urlPath;
} catch (\Exception $e) {
$this->logger->error('DownloadImages: Error while sanitize SVG', ['path' => $imagePath, 'message' => $e->getMessage()]);
return false;
}
}
try {
$im = imagecreatefromstring((string) $res->getBody());
@ -196,7 +223,7 @@ class DownloadImages
imagedestroy($im);
return $this->wallabagUrl . '/assets/images/' . $relativePath . '/' . $hashImage . '.' . $ext;
return $urlPath;
}
/**
@ -351,7 +378,7 @@ class DownloadImages
$this->logger->debug('DownloadImages: Checking extension (alternative)', ['ext' => $ext]);
}
if (!\in_array($ext, ['jpeg', 'jpg', 'gif', 'png', 'webp'], true)) {
if (!\in_array($ext, ['jpeg', 'jpg', 'gif', 'png', 'webp', 'svg'], true)) {
$this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping: ' . $imagePath);
return false;

View file

@ -0,0 +1 @@
{}

View file

@ -37,6 +37,7 @@ menu:
theme_toggle_auto: テーマを自動切換
theme_toggle_dark: ダークテーマ
theme_toggle_light: ライトテーマ
with_annotations: 注釈付きのアイテム
top:
add_new_entry: 新しい記事を追加
search: 検索

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1,10 @@
auth_code:
on: activat
mailer:
subject: codi d'autenticació wallabag
body:
hello: Hola %user%,
second_para: 'Aquí tens el codi:'
support: 'No dubtis a posar-te en contacte amb nosaltres si tens algun problema:'
first_para: Com que necessites una autenticació de dos factors per iniciar la sessió al teu compte de wallabag i un dispositiu nou l'acaba d'utilitzar, t'enviem un codi per validar la teva connexió.
signature: L'equip de wallabag