@ecency/render-helper 2.5.36 → 2.5.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node/index.cjs
CHANGED
|
@@ -741,6 +741,9 @@ function buildSrcSetForFormat(url, format = "match") {
|
|
|
741
741
|
var STATIC_RASTER_PATH_EXT = /\.(?:jpe?g|png|webp)$/i;
|
|
742
742
|
var SIZED_PROXY_PATH = /^\/\d+x\d+\//;
|
|
743
743
|
function isPictureEligibleRawUrl(rawUrl) {
|
|
744
|
+
return isPictureEligible(rawUrl, true);
|
|
745
|
+
}
|
|
746
|
+
function isPictureEligible(rawUrl, mayUnwrapLegacy) {
|
|
744
747
|
if (!rawUrl || typeof rawUrl !== "string") return false;
|
|
745
748
|
let u;
|
|
746
749
|
try {
|
|
@@ -749,7 +752,10 @@ function isPictureEligibleRawUrl(rawUrl) {
|
|
|
749
752
|
return false;
|
|
750
753
|
}
|
|
751
754
|
if (u.protocol !== "http:" && u.protocol !== "https:") return false;
|
|
752
|
-
if (isLegacySizedProxyUrl(rawUrl))
|
|
755
|
+
if (mayUnwrapLegacy && isLegacySizedProxyUrl(rawUrl)) {
|
|
756
|
+
const nested = extractLegacySizedSource(rawUrl);
|
|
757
|
+
return nested !== null && isPictureEligible(nested, false);
|
|
758
|
+
}
|
|
753
759
|
const host = `${u.protocol}//${u.host}`;
|
|
754
760
|
const isProxyHost = host === proxyBase || host === "https://images.ecency.com";
|
|
755
761
|
if (isProxyHost && (u.pathname.startsWith("/p/") || u.pathname.startsWith("/u/") || SIZED_PROXY_PATH.test(u.pathname))) {
|