summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/dropzone_input.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/dropzone_input.js')
-rw-r--r--app/assets/javascripts/dropzone_input.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js
index 337f7ae2757..f98f63529fc 100644
--- a/app/assets/javascripts/dropzone_input.js
+++ b/app/assets/javascripts/dropzone_input.js
@@ -4,6 +4,7 @@ import { escape } from 'lodash';
import './behaviors/preview_markdown';
import { spriteIcon } from '~/lib/utils/common_utils';
import { getFilename } from '~/lib/utils/file_upload';
+import { truncate } from '~/lib/utils/text_utility';
import { n__, __ } from '~/locale';
import PasteMarkdownTable from './behaviors/markdown/paste_markdown_table';
import axios from './lib/utils/axios_utils';
@@ -189,10 +190,13 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
if (image) {
event.preventDefault();
+ const MAX_FILE_NAME_LENGTH = 246;
const filename = getFilename(pasteEvent) || 'image.png';
- const text = `{{${filename}}}`;
+ const truncateFilename = truncate(filename, MAX_FILE_NAME_LENGTH);
+ const text = `{{${truncateFilename}}}`;
pasteText(text);
- return uploadFile(image.getAsFile(), filename);
+
+ return uploadFile(image.getAsFile(), truncateFilename);
}
}
}