Skip to content

Commit 6bf2cc5

Browse files
authored
Update committee.js
1 parent 3f45942 commit 6bf2cc5

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/pages/committee.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ const safeArray = (data) => (Array.isArray(data) ? data : []);
1010

1111
const get = (obj, key) => safeArray(obj?.data?.[key]);
1212

13+
// function toGoogleImageUrl(url = "") {
14+
// const match = url.match(/id=([^&]+)/);
15+
// if (!match) return url;
16+
// return `https://lh3.googleusercontent.com/d/${match[1]}=w500`;
17+
// }
1318
function toGoogleImageUrl(url = "") {
14-
const match = url.match(/id=([^&]+)/);
15-
if (!match) return url;
16-
return `https://lh3.googleusercontent.com/d/${match[1]}=w500`;
19+
const fileId =
20+
url.match(/\/d\/([^/]+)/)?.[1] ||
21+
url.match(/id=([^&]+)/)?.[1];
22+
23+
if (!fileId) return url;
24+
25+
return `https://drive.google.com/uc?export=view&id=${fileId}`;
1726
}
1827

1928
// -----------------------------

0 commit comments

Comments
 (0)