mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-23 07:33:58 -06:00
Be less restrictive when validating long URLs
This commit is contained in:
parent
62488ac4e5
commit
72c4052012
17
CHANGELOG.md
17
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).
|
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
|
||||||
|
* [#1742](https://github.com/shlinkio/shlink/issues/1742) Fix URLs using schemas which do not contain `//`, like `mailto:`, to no longer be considered valid.
|
||||||
|
|
||||||
|
|
||||||
## [3.5.3] - 2023-03-31
|
## [3.5.3] - 2023-03-31
|
||||||
### Added
|
### Added
|
||||||
* *Nothing*
|
* *Nothing*
|
||||||
|
@ -13,7 +13,7 @@ const DEFAULT_REDIRECT_STATUS_CODE = RedirectStatus::STATUS_302; // Deprecated.
|
|||||||
const DEFAULT_REDIRECT_CACHE_LIFETIME = 30;
|
const DEFAULT_REDIRECT_CACHE_LIFETIME = 30;
|
||||||
const LOCAL_LOCK_FACTORY = 'Shlinkio\Shlink\LocalLockFactory';
|
const LOCAL_LOCK_FACTORY = 'Shlinkio\Shlink\LocalLockFactory';
|
||||||
const TITLE_TAG_VALUE = '/<title[^>]*>(.*?)<\/title>/i'; // Matches the value inside a html title tag
|
const TITLE_TAG_VALUE = '/<title[^>]*>(.*?)<\/title>/i'; // Matches the value inside a html title tag
|
||||||
const LOOSE_URI_MATCHER = '/(.+)\:\/\/(.+)/i'; // Matches anything starting with a schema.
|
const LOOSE_URI_MATCHER = '/(.+)\:(.+)/i'; // Matches anything starting with a schema.
|
||||||
const DEFAULT_QR_CODE_SIZE = 300;
|
const DEFAULT_QR_CODE_SIZE = 300;
|
||||||
const DEFAULT_QR_CODE_MARGIN = 0;
|
const DEFAULT_QR_CODE_MARGIN = 0;
|
||||||
const DEFAULT_QR_CODE_FORMAT = 'png';
|
const DEFAULT_QR_CODE_FORMAT = 'png';
|
||||||
|
@ -165,6 +165,20 @@ class ShortUrlCreationTest extends TestCase
|
|||||||
yield ['гугл', 'гугл'];
|
yield ['гугл', 'гугл'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Test, DataProvider('provideValidLongUrls')]
|
||||||
|
public function supportsDifferentTypesOfSchemas(string $longUrl): void
|
||||||
|
{
|
||||||
|
$creation = ShortUrlCreation::fromRawData(['longUrl' => $longUrl]);
|
||||||
|
self::assertEquals($longUrl, $creation->longUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function provideValidLongUrls(): iterable
|
||||||
|
{
|
||||||
|
yield 'mailto' => ['mailto:foo@example.com'];
|
||||||
|
yield 'file' => ['file:///foo/bar'];
|
||||||
|
yield 'https' => ['https://example.com'];
|
||||||
|
}
|
||||||
|
|
||||||
#[Test, DataProvider('provideTitles')]
|
#[Test, DataProvider('provideTitles')]
|
||||||
public function titleIsCroppedIfTooLong(?string $title, ?string $expectedTitle): void
|
public function titleIsCroppedIfTooLong(?string $title, ?string $expectedTitle): void
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user