abmp-npm 1.1.99 → 1.1.100
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.
|
@@ -21,10 +21,12 @@ function isValidImageUrl(url) {
|
|
|
21
21
|
let parsedUrl;
|
|
22
22
|
try {
|
|
23
23
|
parsedUrl = new URL(url);
|
|
24
|
+
console.log('parsedUrl', parsedUrl);
|
|
24
25
|
} catch {
|
|
25
26
|
return false;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
console.log('parsedUrl', parsedUrl);
|
|
29
|
+
console.log('parsedUrl.protocol', parsedUrl.protocol);
|
|
28
30
|
// Only allow HTTP and HTTPS protocols (reject blob:, data:, file:, etc.)
|
|
29
31
|
const validProtocols = ['http:', 'https:'];
|
|
30
32
|
if (!validProtocols.includes(parsedUrl.protocol)) {
|
|
@@ -34,10 +36,10 @@ function isValidImageUrl(url) {
|
|
|
34
36
|
// Extract file extension from URL (handle query parameters)
|
|
35
37
|
const urlPath = url.split('?')[0].toLowerCase();
|
|
36
38
|
const validExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp'];
|
|
37
|
-
|
|
39
|
+
console.log('urlPath', urlPath);
|
|
38
40
|
// Check if URL ends with valid extension
|
|
39
41
|
const hasValidExtension = validExtensions.some(ext => urlPath.endsWith(ext));
|
|
40
|
-
|
|
42
|
+
console.log('hasValidExtension', hasValidExtension);
|
|
41
43
|
// Reject obviously invalid extensions
|
|
42
44
|
const invalidExtensions = [
|
|
43
45
|
'.pdf',
|
|
@@ -52,7 +54,7 @@ function isValidImageUrl(url) {
|
|
|
52
54
|
'_gif',
|
|
53
55
|
];
|
|
54
56
|
const hasInvalidExtension = invalidExtensions.some(ext => urlPath.includes(ext));
|
|
55
|
-
|
|
57
|
+
console.log('hasInvalidExtension', hasInvalidExtension);
|
|
56
58
|
return hasValidExtension && !hasInvalidExtension;
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -139,7 +141,7 @@ async function updateMemberRichContent(memberId) {
|
|
|
139
141
|
async function updateMemberProfileImage(memberId) {
|
|
140
142
|
try {
|
|
141
143
|
const member = await findMemberByWixDataId(memberId);
|
|
142
|
-
const trimmedProfileImage = member.profileImage
|
|
144
|
+
const trimmedProfileImage = member.profileImage?.trim();
|
|
143
145
|
// Check if member has an external profile image URL
|
|
144
146
|
if (!trimmedProfileImage || isWixHostedImage(trimmedProfileImage)) {
|
|
145
147
|
console.log(`Member ${memberId} already has Wix-hosted image or no image`);
|