mirror of
https://github.com/modrinth/code.git
synced 2026-08-27 18:14:49 +00:00
fix: guard against non-strings when decorating download urls (#6194)
This commit is contained in:
@@ -63,7 +63,11 @@ export function useCdnDownloadContext() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function createProjectDownloadUrl(originalUrl: string, context?: DownloadContext): string {
|
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
|
return originalUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
</ButtonStyled>
|
</ButtonStyled>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="input-group mt-2">
|
<div v-else class="input-group mt-2">
|
||||||
<ButtonStyled v-if="primaryFile && !currentMember" color="brand">
|
<ButtonStyled v-if="primaryFile?.url && !currentMember" color="brand">
|
||||||
<a
|
<a
|
||||||
v-tooltip="primaryFile.filename + ' (' + formatBytes(primaryFile.size) + ')'"
|
v-tooltip="primaryFile.filename + ' (' + formatBytes(primaryFile.size) + ')'"
|
||||||
:href="decoratedPrimaryFileUrl"
|
:href="decoratedPrimaryFileUrl"
|
||||||
|
|||||||
Reference in New Issue
Block a user