diff --git a/assets/vue/app/domain/setting/presentation/pages/ScrapperEdit.vue b/assets/vue/app/domain/setting/presentation/pages/ScrapperEdit.vue index 7db1ece..39aecd4 100644 --- a/assets/vue/app/domain/setting/presentation/pages/ScrapperEdit.vue +++ b/assets/vue/app/domain/setting/presentation/pages/ScrapperEdit.vue @@ -86,6 +86,7 @@ :src="imageUrl" :alt="`Image ${index + 1}`" class="w-full h-32 object-cover border border-gray-200 dark:border-gray-600" + referrerpolicy="no-referrer" @error="handleImageError" @load="handleImageLoad" />
@@ -278,6 +279,11 @@ const handleTest = async ({ configuration, testData }) => { testResults.value = {}; try { + // Persister testSlug + testChapterNumber avant de lancer le test + if (isEditing.value) { + await contentSourceStore.updateSource(route.params.id, configuration); + } + // Préparer les données selon le format de l'API const testConfiguration = { baseUrl: configuration.baseUrl, diff --git a/src/Domain/Scraping/Infrastructure/Service/ImageDownloader.php b/src/Domain/Scraping/Infrastructure/Service/ImageDownloader.php index a886bcc..69ffdb6 100644 --- a/src/Domain/Scraping/Infrastructure/Service/ImageDownloader.php +++ b/src/Domain/Scraping/Infrastructure/Service/ImageDownloader.php @@ -20,7 +20,14 @@ readonly class ImageDownloader implements ImageDownloaderInterface public function download(string $url, string $destination): void { - $response = $this->httpClient->request('GET', $url); + $urlParts = parse_url($url); + $referer = ($urlParts['scheme'] ?? 'https') . '://' . ($urlParts['host'] ?? ''); + + $response = $this->httpClient->request('GET', $url, [ + 'headers' => [ + 'Referer' => $referer, + ], + ]); $contentType = $response->getHeaders()['content-type'][0] ?? ''; if (!str_starts_with($contentType, 'image/')) {