Consider two-digit weird version numbers (#1139)

This commit is contained in:
nobody 2022-09-19 18:17:30 +02:00
parent 761d0d5e06
commit 7c33822caa
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
3 changed files with 6 additions and 2 deletions

View File

@ -55,7 +55,7 @@ const MessageResponse = {
const Resource = { const Resource = {
'MAPPING_EXPRESSION': /\.map$/i, 'MAPPING_EXPRESSION': /\.map$/i,
'VERSION_EXPRESSION': /(?:\d{1,2}\.){1,3}\d{1,2}(?:-\d)?|latest/, 'VERSION_EXPRESSION': /(?:\d{1,2}\.){1,3}\d{1,2}(?:-\d)?|latest/,
'SINGLE_NUMBER_EXPRESSION': /^\D+@?\d.*$/, 'SINGLE_NUMBER_EXPRESSION': /^\D+@?\d{1,2}\D*$/,
'MATHJAX': /\/\w.*(?:\d{1,2}\.){1,3}\d{1,2}(?:-\d)?\/|\/(mathjax\/)?latest\//, 'MATHJAX': /\/\w.*(?:\d{1,2}\.){1,3}\d{1,2}(?:-\d)?\/|\/(mathjax\/)?latest\//,
'TINYMCE': /\/\w.*(?:\d{1,2}\.){1,3}\d{1,2}(?:-\d)?\//, 'TINYMCE': /\/\w.*(?:\d{1,2}\.){1,3}\d{1,2}(?:-\d)?\//,
'VERSION_PLACEHOLDER': '{version}' 'VERSION_PLACEHOLDER': '{version}'

View File

@ -151,7 +151,7 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
// Handle weird version expressions // Handle weird version expressions
if (!versionNumber && Resource.SINGLE_NUMBER_EXPRESSION.test(channelPath)) { if (!versionNumber && Resource.SINGLE_NUMBER_EXPRESSION.test(channelPath)) {
versionNumber = channelPath.match(/\d/); versionNumber = channelPath.match(/\d{1,2}/);
resourcePattern = resourcePath.replaceAll(versionNumber, Resource.VERSION_PLACEHOLDER); resourcePattern = resourcePath.replaceAll(versionNumber, Resource.VERSION_PLACEHOLDER);
versionNumber = [`${versionNumber}.0`]; versionNumber = [`${versionNumber}.0`];
} else { } else {

View File

@ -25,6 +25,10 @@
<h2>New in LocalCDN:</h2> <h2>New in LocalCDN:</h2>
</div> </div>
<div class="release-notes-area"> <div class="release-notes-area">
<p>Improved</p>
<ul>
<li>Consider two-digit weird version numbers (<a href="https://codeberg.org/nobody/LocalCDN/issues/1139">#1139</a>)</li>
</ul>
<p>Fixed</p> <p>Fixed</p>
<ul> <ul>
<li>Call CDNs directly to search something on the website (<a href="https://codeberg.org/nobody/LocalCDN/issues/1137">#1137</a>)</li> <li>Call CDNs directly to search something on the website (<a href="https://codeberg.org/nobody/LocalCDN/issues/1137">#1137</a>)</li>