mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Inlcuded tags as part of the ShortUrlMeta
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\Model\CreateShortUrlData;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
||||
use Shlinkio\Shlink\Core\Validation\ShortUrlMetaInputFilter;
|
||||
use Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware;
|
||||
@@ -15,17 +14,17 @@ class SingleStepCreateShortUrlAction extends AbstractCreateShortUrlAction
|
||||
protected const ROUTE_PATH = '/short-urls/shorten';
|
||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
||||
|
||||
protected function buildShortUrlData(Request $request): CreateShortUrlData
|
||||
protected function buildShortUrlData(Request $request): ShortUrlMeta
|
||||
{
|
||||
$query = $request->getQueryParams();
|
||||
$longUrl = $query['longUrl'] ?? null;
|
||||
$apiKey = AuthenticationMiddleware::apiKeyFromRequest($request);
|
||||
|
||||
return new CreateShortUrlData([], ShortUrlMeta::fromRawData([
|
||||
return ShortUrlMeta::fromRawData([
|
||||
ShortUrlMetaInputFilter::LONG_URL => $longUrl,
|
||||
ShortUrlMetaInputFilter::API_KEY => $apiKey,
|
||||
// This will usually be null, unless this API key enforces one specific domain
|
||||
ShortUrlMetaInputFilter::DOMAIN => $request->getAttribute(ShortUrlMetaInputFilter::DOMAIN),
|
||||
]));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user