Simplify thumbnail validation - just check filename

This commit is contained in:
2026-04-17 03:48:50 +10:00
parent 4c1e2c7e84
commit 7f8f5d43db

View File

@@ -228,22 +228,11 @@ for (const file of changedFiles) {
try { try {
new URL(plugin.thumbnail); new URL(plugin.thumbnail);
// Thumbnail must be in the plugin repository
const repoBase = plugin.repository;
if (!plugin.thumbnail.startsWith(repoBase)) {
errors.push(`${file}: Thumbnail must be hosted in your plugin repository: ${plugin.thumbnail}`);
}
// Must be named thumbnail.png, thumbnail.jpg, or thumbnail.gif // Must be named thumbnail.png, thumbnail.jpg, or thumbnail.gif
if (!/\/thumbnail\.(png|jpg|gif)$/i.test(plugin.thumbnail)) { if (!/\/thumbnail\.(png|jpg|gif)$/i.test(plugin.thumbnail)) {
errors.push(`${file}: Thumbnail must be named thumbnail.png, thumbnail.jpg, or thumbnail.gif`); errors.push(`${file}: Thumbnail must be named thumbnail.png, thumbnail.jpg, or thumbnail.gif`);
} }
// Must use raw URL format
if (!plugin.thumbnail.includes('/raw/branch/')) {
errors.push(`${file}: Thumbnail must use raw URL format: {repo}/raw/branch/main/thumbnail.png`);
}
// Validate thumbnail meets requirements // Validate thumbnail meets requirements
try { try {
const thumbInfo = await validateThumbnail(plugin.thumbnail); const thumbInfo = await validateThumbnail(plugin.thumbnail);