feat(media): support external https image urls for entities
Allow entities to use full https:// URLs as their image path Validate external URLs to prevent http://, data:, or credentials Update API responses and frontend components to handle external sources
This commit is contained in:
@@ -586,12 +586,17 @@ function pokemonImageLabel(image: PokemonImage) {
|
||||
if (image.source === 'upload') {
|
||||
return t('media.uploadedImage');
|
||||
}
|
||||
if (image.source === 'external') {
|
||||
return t('media.image');
|
||||
}
|
||||
return `${image.version} - ${image.variant}`;
|
||||
}
|
||||
|
||||
function pokemonImageAlt(image: PokemonImage) {
|
||||
const name = pokemonForm.value.name.trim() || (pokemonForm.value.id.trim() ? `#${pokemonForm.value.id.trim()}` : t('pages.pokemon.title'));
|
||||
return image.source === 'upload' ? t('media.imageAlt', { name }) : t('pages.pokemon.imageAlt', { name, variant: image.variant });
|
||||
return image.source === 'upload' || image.source === 'external'
|
||||
? t('media.imageAlt', { name })
|
||||
: t('pages.pokemon.imageAlt', { name, variant: image.variant });
|
||||
}
|
||||
|
||||
function selectPokemonImage(image: PokemonImage) {
|
||||
|
||||
Reference in New Issue
Block a user