mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Add support for short URL mode in installer, and handle loosely mode in custom slugs
This commit is contained in:
@@ -5,7 +5,6 @@ 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\ShortUrl\Model\ShortUrlCreation;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Model\Validation\ShortUrlInputFilter;
|
||||
@@ -23,8 +22,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 ShortUrlCreation::fromRawData($payload, $this->urlShortenerOptions->mode);
|
||||
return ShortUrlCreation::fromRawData($payload, $this->urlShortenerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ class SingleStepCreateShortUrlAction extends AbstractCreateShortUrlAction
|
||||
ShortUrlInputFilter::API_KEY => $apiKey,
|
||||
// This will usually be null, unless this API key enforces one specific domain
|
||||
ShortUrlInputFilter::DOMAIN => $request->getAttribute(ShortUrlInputFilter::DOMAIN),
|
||||
], $this->urlShortenerOptions->mode);
|
||||
], $this->urlShortenerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user