From 70c1c9f0186651d0732556c36f087e60d6d26d15 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 10 Feb 2023 20:26:18 +0100 Subject: [PATCH] Fix dependency injected in CrawlingHelper --- CHANGELOG.md | 17 ++++++++++ module/Core/config/dependencies.config.php | 2 +- module/Core/test-api/Action/RobotsTest.php | 31 +++++++++++++++++++ .../test-api/Action/ListShortUrlsTest.php | 2 +- .../test-api/Fixtures/ShortUrlsFixture.php | 1 + 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 module/Core/test-api/Action/RobotsTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index b0fc56c4..5426a069 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] +### Added +* *Nothing* + +### Changed +* *Nothing* + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* [#1698](https://github.com/shlinkio/shlink/issues/1698) Fixed error 500 in `robots.txt`. + + ## [3.5.1] - 2023-02-04 ### Added * *Nothing* diff --git a/module/Core/config/dependencies.config.php b/module/Core/config/dependencies.config.php index 4555bff1..567d57ce 100644 --- a/module/Core/config/dependencies.config.php +++ b/module/Core/config/dependencies.config.php @@ -187,7 +187,7 @@ return [ Util\DoctrineBatchHelper::class, ], - Crawling\CrawlingHelper::class => ['em'], + Crawling\CrawlingHelper::class => [ShortUrl\Repository\CrawlableShortCodesQuery::class], ], ]; diff --git a/module/Core/test-api/Action/RobotsTest.php b/module/Core/test-api/Action/RobotsTest.php new file mode 100644 index 00000000..cf1efdb9 --- /dev/null +++ b/module/Core/test-api/Action/RobotsTest.php @@ -0,0 +1,31 @@ +callShortUrl('robots.txt'); + $body = $resp->getBody()->__toString(); + + self::assertEquals(200, $resp->getStatusCode()); + self::assertEquals( + << null, 'title' => null, - 'crawlable' => false, + 'crawlable' => true, 'forwardQuery' => false, ]; private const SHORT_URL_CUSTOM_DOMAIN = [ diff --git a/module/Rest/test-api/Fixtures/ShortUrlsFixture.php b/module/Rest/test-api/Fixtures/ShortUrlsFixture.php index 2d45a7bb..03f3f603 100644 --- a/module/Rest/test-api/Fixtures/ShortUrlsFixture.php +++ b/module/Rest/test-api/Fixtures/ShortUrlsFixture.php @@ -62,6 +62,7 @@ class ShortUrlsFixture extends AbstractFixture implements DependentFixtureInterf 'maxVisits' => 2, 'apiKey' => $authorApiKey, 'longUrl' => 'https://shlink.io', + 'crawlable' => true, 'forwardQuery' => false, ])), '2019-01-01 00:00:20'); $manager->persist($customShortUrl);