Skip to content

Commit 3f20e29

Browse files
authored
MangaDex | Fix title logic (#74)
The title was undefined for certain manga because the default title language for that series was something other than `en` (e.g `ja-ro`) and there were no alternate titles for the series.
1 parent 594b672 commit 3f20e29

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/MangaDex/MangaDexParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const parseMangaList = async (object: MangaItem[], source: any, thumbnail
99
for (const manga of object) {
1010
const mangaId = manga.id
1111
const mangaDetails = manga.attributes
12-
const title = source.decodeHTMLEntity(mangaDetails.title.en ?? mangaDetails.altTitles.map(x => Object.values(x).find((v) => v !== undefined)).find((t) => t !== undefined))
12+
const title = source.decodeHTMLEntity(mangaDetails.title.en ?? Object.values(mangaDetails.title)[0] ?? mangaDetails.altTitles.map(x => Object.values(x).find((v) => v !== undefined)).find((t) => t !== undefined)) ?? 'INVALID TITLE'
1313
const coverFileName = manga.relationships.filter((x) => x.type == 'cover_art').map((x) => x.attributes?.fileName)[0]
1414
const image = coverFileName ? `${source.COVER_BASE_URL}/${mangaId}/${coverFileName}${MDImageQuality.getEnding(await thumbnailSelector(source.stateManager))}` : 'https://mangadex.org/_nuxt/img/cover-placeholder.d12c3c5.jpg'
1515
const subtitle = `${mangaDetails.lastVolume ? `Vol. ${mangaDetails.lastVolume}` : ''} ${mangaDetails.lastChapter ? `Ch. ${mangaDetails.lastChapter}` : ''}`

0 commit comments

Comments
 (0)