Skip to content

Commit

Permalink
fix: Correctly select file to download for modrinth
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Dec 29, 2023
1 parent c58bd46 commit bacc8a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion xmcl-runtime/modrinth/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export class ModrinthService extends AbstractService implements IModrinthService
@Singleton((o) => `${o.version.id}`)
async installVersion({ version, icon, instancePath }: InstallProjectVersionOptions): Promise<InstallModrinthVersionResult> {
const primaryFiles = version.files.filter(f => f.primary)
const files = primaryFiles.length === 0 ? version.files : primaryFiles
let files = primaryFiles.length === 0 ? version.files : primaryFiles
if (files.some(f => f.filename.endsWith('.zip')) &&
files.some(f => f.filename.endsWith('.mrpack') || f.filename.endsWith('.jar'))) {
files = files.filter(f => f.filename.endsWith('.mrpack') || f.filename.endsWith('.jar'))
}
const isSingleFile = files.length === 1
const resources = await Promise.all(files.map(async (file) => {
this.log(`Try install project version file ${file.filename} ${file.url}`)
Expand Down

0 comments on commit bacc8a3

Please sign in to comment.