Fix document path parsing in frontend and sync type on new sync

This commit is contained in:
Simon Prévost 2019-01-11 13:19:52 -05:00
parent 3d83985b32
commit 6621db4a15
2 changed files with 10 additions and 6 deletions

View File

@ -114,8 +114,11 @@ export default Component.extend({
fileChange(files) {
const fileSource = files[0];
const documentPath = fileSource.name;
const documentFormat = this._formatFromExtension(documentPath.split('.').pop());
const filename = fileSource.name.split('.');
const fileExtension = filename.pop();
const documentPath = filename.join('.');
const documentFormat = this._formatFromExtension(fileExtension);
const isFileReading = true;
const isFileRead = false;
const reader = new FileReader();

View File

@ -27,7 +27,7 @@ export default Controller.extend({
this.set('revisionOperations', null);
},
peek({fileSource, documentFormat, documentPath, revision}) {
peek({fileSource, documentFormat, documentPath, revision, syncType}) {
const file = fileSource;
const project = this.project;
const revisions = this.revisions;
@ -39,17 +39,18 @@ export default Controller.extend({
revisions,
file,
documentPath,
documentFormat
documentFormat,
syncType
})
.then(revisionOperations => this.set('revisionOperations', revisionOperations));
},
sync({fileSource, documentFormat, documentPath, revision}) {
sync({fileSource, documentFormat, documentPath, revision, syncType}) {
const file = fileSource;
const project = this.project;
return this.syncer
.sync({project, revision, file, documentPath, documentFormat})
.sync({project, revision, file, documentPath, documentFormat, syncType})
.then(() => this.flashMessages.success(this.i18n.t(FLASH_MESSAGE_CREATE_SUCCESS)))
.then(() => this.send('closeModal'))
.catch(() => this.flashMessages.error(this.i18n.t(FLASH_MESSAGE_CREATE_ERROR)));