Skip to content

Commit 28a1ba8

Browse files
authored
Merge pull request #343 from decaf-dev/dev
1.42.2
2 parents 245da7c + 2c96a13 commit 28a1ba8

File tree

4 files changed

+19
-26
lines changed

4 files changed

+19
-26
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "vault-explorer",
33
"name": "Vault Explorer",
4-
"version": "1.44.1",
4+
"version": "1.44.2",
55
"minAppVersion": "1.4.13",
66
"description": "Explore your vault in visual format",
77
"author": "DecafDev",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-vault-explorer",
3-
"version": "1.44.1",
3+
"version": "1.44.2",
44
"description": "Explore your vault in visual format",
55
"main": "main.js",
66
"scripts": {

src/svelte/app/components/grid-card.svelte

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -156,28 +156,13 @@
156156
},
157157
);
158158
159-
let websiteUrl = target.src;
160-
if (websiteUrl.endsWith("/")) {
161-
websiteUrl = websiteUrl.slice(0, -1); // Remove the trailing slash
162-
}
163-
Logger.debug(
164-
{
165-
fileName: "grid-card.svelte",
166-
functionName: "handleImageError",
167-
message: "websiteUrl",
168-
},
169-
{
170-
websiteUrl,
171-
},
172-
);
173-
174159
if (loadSocialMediaImage) {
175-
const socialUrl = await fetchSocialMediaImage(websiteUrl);
160+
const socialUrl = await fetchSocialMediaImage(target.src);
176161
if (socialUrl) {
177-
await putSMICacheEntry(websiteUrl, socialUrl);
162+
await putSMICacheEntry(target.src, socialUrl);
178163
target.src = socialUrl;
179164
} else {
180-
await putSMICacheEntry(websiteUrl, null);
165+
await putSMICacheEntry(target.src, null);
181166
}
182167
}
183168
}
@@ -190,24 +175,31 @@
190175
functionName: "getCachedSocialMediaUrl",
191176
message: "result",
192177
});
193-
const entry = await getSMICacheEntry(websiteUrl);
178+
179+
//e.target.src will use the DOM href which may end in a slash
180+
//target.src will output https://x.com/ if the URL is https://x.com
181+
//this will cause the cache to not find the image
182+
//We need to use the URL API to get a consistent URL format
183+
//See line 160
184+
const url = new URL(websiteUrl);
185+
const entry = await getSMICacheEntry(url.href);
194186
195187
if (entry) {
196188
const { smiUrl } = entry;
197189
198190
if (smiUrl) {
199191
const isExpired = await isSMICacheEntryExpired(entry);
200192
if (!isExpired) {
201-
return { status: "SUCCESS", websiteUrl, smiUrl };
193+
return { status: "SUCCESS", websiteUrl: url.href, smiUrl };
202194
} else {
203-
return { status: "EXPIRED", websiteUrl, smiUrl }; // Image found but expired
195+
return { status: "EXPIRED", websiteUrl: url.href, smiUrl }; // Image found but expired
204196
}
205197
} else {
206-
return { status: "NO_IMAGE", websiteUrl, smiUrl }; // Image was previously cached but doesn't exist
198+
return { status: "NO_IMAGE", websiteUrl: url.href, smiUrl }; // Image was previously cached but doesn't exist
207199
}
208200
}
209201
210-
return { status: "NOT_FOUND", websiteUrl, smiUrl: null }; // Website URL doesn't have a cached image
202+
return { status: "NOT_FOUND", websiteUrl: url.href, smiUrl: null }; // Website URL doesn't have a cached image
211203
}
212204
213205
$: if (imageUrl) {

versions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,6 @@
142142
"1.43.0": "1.4.13",
143143
"1.43.1": "1.4.13",
144144
"1.44.0": "1.4.13",
145-
"1.44.1": "1.4.13"
145+
"1.44.1": "1.4.13",
146+
"1.44.2": "1.4.13"
146147
}

0 commit comments

Comments
 (0)