Saved filename fixed so that clients display it correctly #2415 (#2705)

* increased filename length to 36 to make sure clients display correct filename

* increased filename length to 36 to make sure clients display correct filename

* added uuid prefix to saved filenames
This commit is contained in:
Lama Chandrasena
2016-09-18 03:57:31 +09:30
committed by Florent Vilmart
parent 4c927dd898
commit 22c1a87d80
2 changed files with 3 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import AdaptableController from './AdaptableController';
import { FilesAdapter } from '../Adapters/Files/FilesAdapter';
import path from 'path';
import mime from 'mime';
import uuid from 'node-uuid';
const legacyFilesRegex = new RegExp("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}-.*");
@@ -26,7 +27,7 @@ export class FilesController extends AdaptableController {
contentType = mime.lookup(filename);
}
filename = randomHexString(32) + '_' + filename;
filename = uuid.v4() + '_' + filename;
var location = this.adapter.getFileLocation(config, filename);
return this.adapter.createFile(filename, data, contentType).then(() => {