mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Ensure filtering of custom-slug is different depending on the multi-sement lugsfeature flag
This commit is contained in:
@@ -10,14 +10,16 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Shlinkio\Shlink\Common\Rest\DataTransformerInterface;
|
||||
use Shlinkio\Shlink\Core\Exception\ValidationException;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
||||
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||
use Shlinkio\Shlink\Rest\Action\AbstractRestAction;
|
||||
|
||||
abstract class AbstractCreateShortUrlAction extends AbstractRestAction
|
||||
{
|
||||
public function __construct(
|
||||
private UrlShortenerInterface $urlShortener,
|
||||
private DataTransformerInterface $transformer,
|
||||
private readonly UrlShortenerInterface $urlShortener,
|
||||
private readonly DataTransformerInterface $transformer,
|
||||
protected readonly UrlShortenerOptions $urlShortenerOptions,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Shlinkio\Shlink\Core\Config\EnvVars;
|
||||
use Shlinkio\Shlink\Core\Exception\ValidationException;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
||||
use Shlinkio\Shlink\Core\Validation\ShortUrlInputFilter;
|
||||
@@ -22,6 +23,7 @@ class CreateShortUrlAction extends AbstractCreateShortUrlAction
|
||||
{
|
||||
$payload = (array) $request->getParsedBody();
|
||||
$payload[ShortUrlInputFilter::API_KEY] = AuthenticationMiddleware::apiKeyFromRequest($request);
|
||||
$payload[EnvVars::MULTI_SEGMENT_SLUGS_ENABLED->value] = $this->urlShortenerOptions->multiSegmentSlugsEnabled();
|
||||
|
||||
return ShortUrlMeta::fromRawData($payload);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user