Fix upload with small file names

pull/336/head
Chocobozzz 2018-03-12 11:29:38 +01:00
parent b64c950a1c
commit f2c3f7cd8a
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 1 deletions

View File

@ -156,7 +156,16 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy
this.videoFileName = videofile.name
const name = videofile.name.replace(/\.[^/.]+$/, '')
const nameWithoutExtension = videofile.name.replace(/\.[^/.]+$/, '')
let name: string
// If the name of the file is very small, keep the extension
if (nameWithoutExtension.length < 3) {
name = videofile.name
} else {
name = nameWithoutExtension
}
const privacy = this.firstStepPrivacyId.toString()
const nsfw = false
const commentsEnabled = true