From f2c3f7cd8a592ca1949e4f73717f17132a16c292 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 12 Mar 2018 11:29:38 +0100 Subject: [PATCH] Fix upload with small file names --- .../src/app/videos/+video-edit/video-add.component.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 4c9dbf1bb..ae5548897 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts @@ -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 -- 2.25.1