Fix oauth appliction icon upload (#6913)

This commit is contained in:
Prospector
2026-07-28 16:30:21 -07:00
committed by GitHub
parent 30f64c0020
commit 920dc8dcbb
2 changed files with 5 additions and 6 deletions
@@ -549,7 +549,7 @@ async function onImageSelection(files) {
const file = files[0] const file = files[0]
const extFromType = file.type.split('/')[1] const extFromType = file.type.split('/')[1]
await client.labrinth.oauth_internal.uploadAppIcon(editingId.value, file, extFromType).promise await client.labrinth.oauth_internal.uploadAppIcon(editingId.value, file, extFromType)
await refresh() await refresh()
@@ -1,5 +1,4 @@
import { AbstractModule } from '../../../core/abstract-module' import { AbstractModule } from '../../../core/abstract-module'
import type { UploadHandle } from '../../../types/upload'
import type { Labrinth } from '../types' import type { Labrinth } from '../types'
export class LabrinthOAuthInternalModule extends AbstractModule { export class LabrinthOAuthInternalModule extends AbstractModule {
@@ -110,14 +109,14 @@ export class LabrinthOAuthInternalModule extends AbstractModule {
* @param id - The OAuth client ID * @param id - The OAuth client ID
* @param file - The icon file * @param file - The icon file
* @param ext - The file extension (e.g. 'png', 'jpeg') * @param ext - The file extension (e.g. 'png', 'jpeg')
* @returns UploadHandle for progress tracking and cancellation
*/ */
public uploadAppIcon(id: string, file: File | Blob, ext: string): UploadHandle<void> { public async uploadAppIcon(id: string, file: File | Blob, ext: string): Promise<void> {
return this.client.upload<void>(`/oauth/app/${id}/icon`, { return this.client.request(`/oauth/app/${id}/icon`, {
api: 'labrinth', api: 'labrinth',
version: 'internal', version: 'internal',
file, method: 'PATCH',
params: { ext }, params: { ext },
body: file,
}) })
} }