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