fix: guard against non-strings when decorating download urls (#6194)

This commit is contained in:
Prospector
2026-05-24 10:42:27 -07:00
committed by GitHub
parent 3889d0f5ec
commit bcce7e28fd
2 changed files with 6 additions and 2 deletions
@@ -63,7 +63,11 @@ export function useCdnDownloadContext() {
})
function createProjectDownloadUrl(originalUrl: string, context?: DownloadContext): string {
if (!originalUrl.startsWith('https://cdn.modrinth.com')) {
if (
typeof originalUrl !== 'string' ||
!originalUrl ||
!originalUrl.startsWith('https://cdn.modrinth.com')
) {
return originalUrl
}
@@ -136,7 +136,7 @@
</ButtonStyled>
</div>
<div v-else class="input-group mt-2">
<ButtonStyled v-if="primaryFile && !currentMember" color="brand">
<ButtonStyled v-if="primaryFile?.url && !currentMember" color="brand">
<a
v-tooltip="primaryFile.filename + ' (' + formatBytes(primaryFile.size) + ')'"
:href="decoratedPrimaryFileUrl"