[mastodon-client] drive file name fixup
This commit is contained in:
parent
12d7246bf3
commit
69d1c9746a
1 changed files with 3 additions and 6 deletions
|
@ -1646,17 +1646,14 @@ export default class Misskey implements MegalodonInterface {
|
||||||
public async uploadMedia(file: any, options?: { description?: string; focus?: string }): Promise<Response<Entity.Attachment>> {
|
public async uploadMedia(file: any, options?: { description?: string; focus?: string }): Promise<Response<Entity.Attachment>> {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('file', fs.createReadStream(file.path), {
|
formData.append('file', fs.createReadStream(file.path), {
|
||||||
contentType: file.mimetype,
|
contentType: file.mimetype
|
||||||
filename: file.originalname
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (file.originalname != null) {
|
if (file.originalname != null && file.originalname !== 'file')
|
||||||
formData.append('name', file.originalname);
|
formData.append('name', file.originalname);
|
||||||
}
|
|
||||||
|
|
||||||
if (options?.description != null) {
|
if (options?.description != null)
|
||||||
formData.append('comment', options.description);
|
formData.append('comment', options.description);
|
||||||
}
|
|
||||||
|
|
||||||
let headers: { [key: string]: string } = {}
|
let headers: { [key: string]: string } = {}
|
||||||
if (typeof formData.getHeaders === 'function') {
|
if (typeof formData.getHeaders === 'function') {
|
||||||
|
|
Loading…
Reference in a new issue