From: Chocobozzz Date: Mon, 12 Mar 2018 10:29:38 +0000 (+0100) Subject: Fix upload with small file names X-Git-Tag: v1.0.0-alpha.7~4 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f2c3f7cd8a592ca1949e4f73717f17132a16c292;p=oweals%2Fpeertube.git Fix upload with small file names --- 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